我的PHP脚本不起作用 [英] My PHP script doesnt work

查看:72
本文介绍了我的PHP脚本不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Windows 8并在端口80上运行wamp-joomla网站。



现在我在端口8080上有另一个使用iis的html网站。到目前为止超好的。两个网站都运行良好。除了安装在c:\ wamp的wamp堆栈之外,另一个PHP安装位于c:\ php以便与iis一起使用。



通过输入http:// myip:8080 / phpinfo.php,可以从局域网上的另一台PC访问php版本。 phpinfo.php文件位于网站文件夹的根目录中。



我的主页在同一文件夹中使用对页面计数器脚本'counter.php'的引用。如果我直接输入http:// myip:8080 / counter.php,那么php文件会执行,但是当我的主页'index.html'中嵌入了相同的counter.php时,没有输出。



'counter.php'的内容如下:

I have a windows 8 installation with a wamp-joomla website running on port 80.

Now I have another html site using iis on port 8080. So far so good. Both sites work fine. Apart from the wamp stack installed at c:\wamp, Another PHP install exists at c:\php for use with iis.

The php version can be accessed from another pc on my LAN by typing http://myip:8080/phpinfo.php. The phpinfo.php file resides in the root of website folder.

My homepage uses a reference to a page counter script 'counter.php' also in the same folder. if I type http://myip:8080/counter.php directly, the php file executes, however, there is no output when the same counter.php is embedded in my home page 'index.html'.

contents of 'counter.php' are as under:

$count_my_page = ("hitcounter.txt");
$fp = fopen($count_my_page , "r");
$hits = file($count_my_page);
$hits[0] ++;
fclose($fp);
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo "Hits ", "$hits[0]", "";
?>





我做错了什么?如何访问计数器脚本?



当我直接访问counter.php时,每次计数器只读1时。





我的主页只需调用counter.php:





包括'counter.php';

?>



What am I doing wrong ? How can I access the counter script ?

Also when I directly access counter.php, everytime the counter reads 1 only.


My home page calls the counter.php by simply :


include 'counter.php';
?>

推荐答案

count_my_page =( hitcounter.txt);
count_my_page = ("hitcounter.txt");


fp = fopen(
fp = fopen(


count_my_page, r);
count_my_page , "r");


这篇关于我的PHP脚本不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆