请教各位大虾一个小问题!!!急!!! 将这段程序保存为xxx.php在HTML主页的某个地方,<?phpecho file_getc_contents("xxx.php");?> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把你这段代码写到一个单独的PHP文件然后最后句这样改下echo "document.write('\t", $total, "\n');";在你的HTML页面要显示的地方这样引用你的那个PHP页<script type="text/javascript" src="myecho.php"></script> <?phpfunction getTxt(){ $filter = '620107'; $handle = fopen("today_6201.xd", "r"); $total = 0; if ($handle) { while (!feof($handle)) { $argn = fgets($handle, 4096); $p = explode("|", trim($argn)); if (empty($filter) || $p[0] == $filter) { $total += $p[5] > 0 ? $p[8] : (0 + $p[8]); } } fclose($handle); } return $total;}?> 写个成函数形式吧,在你要插入的位置直接<?PHP echo getTxt();?> 照楼上的做了不行啊!!!!!郁闷急急急!!!求知道的解决下!!!!!这段PHP运行结果是个数字!!我要把这个数字直接显示到主页的一个表中!!!!!! <?php function getTxt(){ $filter = '620107'; $handle = fopen("today_6201.xd", "r"); $total = 0; if ($handle) { while (!feof($handle)) { $argn = fgets($handle, 4096); $p = explode("|", trim($argn)); if (empty($filter) || $p[0] == $filter) { $total += $p[5] > 0 ? $p[8] : (0 + $p[8]); } } fclose($handle); } return $total; } ?> 这样写连正常显示都没有了!! 静态页面上用不来php代码的你可以先写好放在一个aa.php页面在通过<iframe 或脚本调用 php代码和HTML可以混合在一起;要实现你所说的要求,可以这样做<html><head></head><body><?php $filter = '620107'; $handle = fopen("today_6201.xd", "r"); $total = 0; if ($handle) { while (!feof($handle)) { $argn = fgets($handle, 4096); $p = explode("|", trim($argn)); if (empty($filter) || $p[0] == $filter) { $total += $p[5] > 0 ? $p[8] : (0 + $p[8]); } } fclose($handle); } ?><p><?php echo $total; ?></p></body></html> 我的cookie删除掉 咨询php新闻发布系统或内容管理系统 得到字符串长度问题 请问下面这段代码用PHP怎么解密 请教:head()问题 请问怎么在PHP中显示书名号? 显示word文档的问题??? PHP调用DLL文件的疑问 怎么修改系统的host文件啊 redis 异常RedisException: Redis server went away [求助]使用php读取文件/引入其他页面内容的问题 非常业余的问题。。。
然后最后句这样改下
echo "document.write('\t", $total, "\n');";在你的HTML页面要显示的地方这样引用你的那个PHP页
<script type="text/javascript" src="myecho.php"></script>
function getTxt(){
$filter = '620107';
$handle = fopen("today_6201.xd", "r");
$total = 0;
if ($handle) {
while (!feof($handle)) {
$argn = fgets($handle, 4096);
$p = explode("|", trim($argn));
if (empty($filter) || $p[0] == $filter) {
$total += $p[5] > 0 ? $p[8] : (0 + $p[8]);
}
}
fclose($handle);
}
return $total;
}?>
写个成函数形式吧,在你要插入的位置直接
<?PHP echo getTxt();?>
function getTxt(){
$filter = '620107';
$handle = fopen("today_6201.xd", "r");
$total = 0;
if ($handle) {
while (!feof($handle)) {
$argn = fgets($handle, 4096);
$p = explode("|", trim($argn));
if (empty($filter) || $p[0] == $filter) {
$total += $p[5] > 0 ? $p[8] : (0 + $p[8]);
}
}
fclose($handle);
}
return $total;
} ?>
这样写连正常显示都没有了!!
你可以先写好放在一个aa.php页面
在通过<iframe
或脚本调用
<html>
<head></head>
<body>
<?php
$filter = '620107';
$handle = fopen("today_6201.xd", "r");
$total = 0;
if ($handle) {
while (!feof($handle)) {
$argn = fgets($handle, 4096);
$p = explode("|", trim($argn));
if (empty($filter) || $p[0] == $filter) {
$total += $p[5] > 0 ? $p[8] : (0 + $p[8]);
}
}
fclose($handle);
}
?>
<p><?php echo $total; ?></p>
</body>
</html>