我的问题很疯狂。因为,当我使用此代码执行网页时,我有一个运行良好的 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 标签。并保存为一个独立的 php 脚本,我使用 Cron 每五分钟运行一次。不起作用。有什么帮助吗?
附言。我尝试手动编辑我的本地 .json 文件,以确保它不起作用。
编辑:我复制了所有内容的开头<?php
和结尾?>
。包括标签。