下面的代碼生成它包含的代碼在$開始$ result變量PHP自動生成在同一文件
$path = "./files/";
$path2="http://".$_SERVER['SERVER_NAME'].dirname($_SERVER["PHP_SELF"])."/files/";
//echo $path2;
$folder = opendir($path);
$start="<asx version='3.0'>\n<title>Example ASX playlist</title>";
$Fnm = "./playlist.php";
$inF = fopen($Fnm,"w");
fwrite($inF,$start."\n");
while($file = readdir($folder)) {
if (($file != '.')&&($file != '..')&&($file != 'index.htm')){
$result="<entry>\n<title>$file</title>\n<ref href='$path2$file'/>\n<param name='image' value='preview.jpg'/>\n</entry>\n";
fwrite($inF,$result);
}
}
fwrite($inF,"</asx>");
closedir($folder);
fclose($inF);
我想生成相同的相同的代碼一個新的PHP文件playlist.php代碼包含此代碼的文件在指定的行號 這是可能的嗎?
以上PHP腳本生成一個新文件 http://tinypaste.com/ff242cd6
你想生成一個php文件,其中不包含實際的php代碼?爲什麼? – 2012-07-28 18:07:12
我知道我沒有在這裏包含php代碼 這段代碼會在php標籤下面生成嗎?> – user1528878 2012-07-28 18:13:45
我不明白這個問題。您能否認真解釋「相同的代碼」和「在同一個文件中」的含義? – octern 2012-07-28 18:18:54