php不执行的怪异有关问题
php不执行的怪异问题
一个html和php结合的页面,本机运行正常,传到空间就不能执行,其他php页面可以正常显示,经过测试我发现里面有require_once语句就无法执行,换成include可以执行通过了,但是到了创建类的时候又不执行了,echo语句放到$q_Servie = new q_Service ();前面可以执行,放到后面就不执行。index_Service.class.php文件里面也调用类,也是相对路径( include('/database/sqlhelper.class.php');),不知道有没有关系。本机wamp,mysql5.5,php5.4,空间的数据库是5.0的,请帮忙看看怎么回事。
------解决方案--------------------
include('/database/sqlhelper.class.php');
include("/member/index_Service.class.php");
都是绝对路径,加载不了是正常的
能加载才是错误的
------解决方案--------------------
尽量不要php代码和html代码混编了。一般都用smarty模板来搞了。
一个html和php结合的页面,本机运行正常,传到空间就不能执行,其他php页面可以正常显示,经过测试我发现里面有require_once语句就无法执行,换成include可以执行通过了,但是到了创建类的时候又不执行了,echo语句放到$q_Servie = new q_Service ();前面可以执行,放到后面就不执行。index_Service.class.php文件里面也调用类,也是相对路径( include('/database/sqlhelper.class.php');),不知道有没有关系。本机wamp,mysql5.5,php5.4,空间的数据库是5.0的,请帮忙看看怎么回事。
<div id="bodyright">
<?php
include("/member/index_Service.class.php");
$pagenow=0;
$pagesize=24;
$q_Servie = new q_Service ();
$res=$q_Servie->get_quan_list($pagenow, $pagesize);
for($i = 0; $i < count ( $res); $i ++) {
$row = $res [$i];
$photo = "upload_file/{$row['q_creator']}/{$row['q_photo']}";
$q_secrecy = $row ['q_secrecy'];
if ($row ['q_photo'] == "") {
$photo = "upload_file/quan.png";
}
echo " <div class='fieldset'><form action='content.php' method='post' ff={$row['q_id']}>
<div class='legend' > [{$row['q_id']}]<h7>{$row['q_name']}</h7></div>
<div class='div-t'><img class='tx' src='$photo'/><p class='p-about'>{$row['q_about']}</p></div>
<div class='db'><img class='ys' src='img/member.png' style='width:16px;' title='网站注册会员可用'/><input type='hidden' name='q_id' value={$row['q_id']} />
<input type='button' class='jr' q_id={$row['q_id']} value='申请加入' /> <input id={$row['q_id']} q_secrecy=$q_secrecy type='button' value='进入' class='bt' /> </div>
</form></div>";
}
?>
</div>
------解决方案--------------------
include('/database/sqlhelper.class.php');
include("/member/index_Service.class.php");
都是绝对路径,加载不了是正常的
能加载才是错误的
------解决方案--------------------
尽量不要php代码和html代码混编了。一般都用smarty模板来搞了。