1
需要生成以下輸出的HTML代碼保存在txt文件的HTML輸出與PHP
<?php
function video() {
$video = 'BYN-DEM7Mzw';
echo '<script type="text/javascript">
function youtubeFeedCallback(data){
document.writeln(data.entry[ "media$group" ][ "media$description" ].$t.replace(/\n/g, "<br/>") + "<br/>"); }
</script>
<script type="text/javascript" src="http://gdata.youtube.com/feeds/api/videos/'.$video.'?v=2&alt=json-in-script&callback=youtubeFeedCallback"></script>';
}
ob_start();
video();
$output = ob_get_clean();
$desc = $output;
$video = 'BYN-DEM7Mzw';
$arq = $video.".txt";
$f = fopen($arq, "w+");
fclose;
$f = fopen($arq, "a+");
$content = "";
if(filesize($arq) > 0)
$content = fread($f, filesize($arq));
fwrite($f, $desc);
fclose($f);
?>
問題該文件被保存了我的腳本,而不是輸出HTML
你要保存的結果是YouTube會回來嗎? – DonSeba 2012-07-20 13:37:55
我想保存從YouTube生成的輸出,如果視頻的描述 – 2012-07-20 13:51:18
這樣他們就可以理解我的問題,我需要通過視頻的id從YouTube獲取視頻的描述並將此描述保存在自定義字段中使用相同的格式youtube – 2012-07-20 14:56:34