0

私の問題はかなりクレイジーです。なぜなら、このコードでWebページを実行すると実行される完全に機能するPHPスクリプトがあるからです..

<html>
<body>
<p>Hello</P>
<?php
$file1 = file_get_contents("http://services.runescape.com/m=itemdb_rs/api/graph/440.json");
$file2 = file_get_contents("http://services.runescape.com/m=itemdb_rs/api/graph            /434.json");
$file3 = file_get_contents("http://services.runescape.com/m=itemdb_rs/api/graph/10294.json");
$file4 = file_get_contents("http://services.runescape.com/m=itemdb_rs/api/graph/2621.json");
$file5 = file_get_contents("../json/440.json");
$file6 = file_get_contents("../json/434.json");
$file7 = file_get_contents("../json/10294.json");
$file8 = file_get_contents("../json/2621.json");
if(($file1 != $file5)or($file2 != $file6)or($file3 != $file7)or($file4 != $file8))
{








$my_t=getdate(date("U"));
$hour = $my_t[hours];
$setTime = 12;
$ending = " # ";
if($hour > $setTime){
$hour-=$setTime;
$ending = "PM";
}else{
$ending = "AM";
}

print($file);
print("$my_t[weekday], $my_t[month] $my_t[mday], $my_t[year]   $hour:$my_t[minutes] $ending");
 $to = "php.tester@mailinator.com";
 $subject = "Ge Has Updated";
 $body = "$my_t[weekday], $my_t[month] $my_t[mday], $my_t[year]     \n$hour:$my_t[minutes] $ending";
 if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent to ".$to." !</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }

copy("http://services.runescape.com/m=itemdb_rs/api/graph/440.json","../json/440.json");
copy("http://services.runescape.com/m=itemdb_rs/api/graph/434.json","../json/434.json");
copy("http://services.runescape.com/m=itemdb_rs/api/graph/10294.json","../json/10294.json");
copy("http://services.runescape.com/m=itemdb_rs/api/graph/2621.json","../json/2621.json");

 } 
?>
</body>
</html>

しかし、タグのコンテンツを取り除くだけの場合<?php.... ?>...しかし、phpタグもコピーします。Cronを使用して5分ごとに実行するスタンドアロンのphpスクリプトとして保存します。効果がないでしょう。何か助けはありますか?

ps。ローカルの .json ファイルを手動で編集して、機能していないことを確認しました。

編集:私は最初<?phpから最後?>まですべてをコピーしました。タグが含まれています。

4

2 に答える 2

1

スクリプトは実行可能です。また、スクリプト自体の相対パスを絶対パスに変更することも考えられます。

https://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work

于 2012-09-19T21:20:26.417 に答える
0

<?php....?>PHP スクリプトは、タグがないと実行されません。

于 2012-09-19T20:37:01.913 に答える