php脚本没有’;从html(raspberry pi)调用时无法正常工作
我正在树莓皮上创建一个网页 以下是我的html代码的精髓:php脚本没有’;从html(raspberry pi)调用时无法正常工作,php,html,jquery,linux,raspberry-pi,Php,Html,Jquery,Linux,Raspberry Pi,我正在树莓皮上创建一个网页 以下是我的html代码的精髓: <html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script&
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
setInterval(function(){
$("#test").load('climate.php') //load php result on the page
}, 1000);
});
</script>
</head>
<body data-gr-c-s-loaded="true">
<div id="test"></div>
</body></html>
但在网页上,这不起作用:
将显示我的“找不到文件”消息
有没有人能解释一下这里发生了什么
提前谢谢你
精度:
- 我的php脚本和html都位于/var/www/html/home中
- 文本文件位于/var/tmp/climate/save_climate.txt中。cron每隔10分钟更新一次他,这就是他不在同一目录中的原因
- 我的网站和php脚本运行良好,问题来自其他地方
- 我的网站位于本地网络上,完全由我的raspi托管
- 我是拉斯比·巴斯特
html
或html
。Linux文件路径区分大小写afaikall是小写的,我的网站运行良好,这是唯一的问题您将文件存储在哪里以便apache读取?您使用的url是什么?列出它html
或html
。Linux文件路径区分大小写afaikall是小写的,我的网站运行良好,这是唯一的问题
<?php
$filename = "/var/tmp/climate/save_climate.txt";
if(file_exists($filename)){
echo file_get_contents($filename);
}
else {
echo 'could not find file'
}
?>
pi@raspberrypi:/var/www/HTML/home $ PHP climate.php
Temp=20.0* Humidity=64.0%