Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: swf_closefile - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

swf_definebitmap" width="11" height="7"/> <swf_addcolor
Last updated: Mon, 05 Feb 2007

view this page in

swf_closefile

(PHP 4)

swf_closefile — 現在の Shockwave Flash ファイルを閉じる

説明

mixed swf_closefile ( [int return_file] )

swf_openfile() 関数によりオープンされたファイルを 閉じます。

パラメータ

return_file

設定されている場合、SWF ファイルの内容が関数から返されます。

返り値

return_file が設定されている場合は SWF ファイルの内容、それ以外の場合は NULL を返します。

例 2342. ユーザの入力に基づき簡単な flash ファイルを生成し、出力します。 また、データベースにこれを保存します。

<?php

// 変数$textはユーザにより投稿されます。

// データベースアクセス用のグローバル変数
// (swf_savedata()関数で使用)
$DBHOST = "localhost";
$DBUSER = "sterling";
$DBPASS = "secret";

swf_openfile("php://stdout", 256, 256, 30, 1, 1, 1);

  
swf_definefont(10, "Ligon-Bold");
      
swf_fontsize(12);
      
swf_fontslant(10);

  
swf_definetext(11, $text, 1);

  
swf_pushmatrix();
      
swf_translate(-50, 80, 0);
      
swf_placeobject(11, 60);
  
swf_popmatrix();

  
swf_showframe();

  
swf_startdoaction();
      
swf_actionstop();
  
swf_enddoaction();

$data = swf_closefile(1);

$data ?
 
swf_savedata($data) :
  die(
"Error could not save SWF file");

// void swf_savedata (string data)
// 後で取得できるように生成されたファイルをデータベースに保存します。
function swf_savedata($data)
{
   global
$DBHOST,
          
$DBUSER,
          
$DBPASS;

  
$dbh = @mysql_connect($DBHOST, $DBUSER, $DBPASS);

   if (!
$dbh) {
       die (
sprintf("Error [%d]: %s",
                    
mysql_errno(), mysql_error()));
   }

  
$stmt = "INSERT INTO swf_files (file) VALUES ('$data')";

  
$sth = @mysql_query($stmt, $dbh);

   if (!
$sth) {
       die (
sprintf("Error [%d]: %s",
                    
mysql_errno(), mysql_error()));
   }

   @
mysql_free_result($sth);
   @
mysql_close($dbh);
}
?>



add a note add a note User Contributed Notes
swf_closefile
There are no user contributed notes for this page.

swf_definebitmap" width="11" height="7"/> <swf_addcolor
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites