<html>
<head>
<title>显示用户信息</title>
</head>

<body>
<?php 
//include 'entity/user.php'; 不能这样包含吗 怎么报错了?
include 'server/userServer.php';
$server=new userServer();
$users=$server->selectUser();
?>
<table align="center" border="1" cellpadding="0" cellspacing="0">
<tr>
<th>用户编号</th>
<th>用户名称</th>
<th>用户年龄</th>
<th>用户性别</th>
</tr>
<?php 
echo count($users)."==============================";
foreach ($users as $user){
echo "<tr>";
echo "<td>".$user[0]."</td>";
echo "<td>".$user[1]."</td>";
echo "<td>".$user[2]."</td>";
echo "<td>".$user[3]."</td>";
echo "</tr>";
}
?>

</table>

</body>
</html>
-------------------------------报错-----------------------------------;Warning: include(server/userServer.php) [function.include]: failed to open stream: No such file or directory in D:\wamp\www\mysql\show\showUser.php on line 9Warning: include() [function.include]: Failed opening 'server/userServer.php' for inclusion (include_path='.;C:\php5\pear') in D:\wamp\www\mysql\show\showUser.php on line 9Fatal error: Class 'userServer' not found in D:\wamp\www\mysql\show\showUser.php on line 10

解决方案 »

  1.   

     没有错啊 就是在entity 文件夹 下面的user.php中啊
      

  2.   

    你要看相对路径是相对哪个文件。
    如果A include B, B include C, A是显示页面,那么B中include也要用相对于A的路径。
      

  3.   


    电脑是不会说谎的,所以仔细检查核对。
    将图片传到CSDN的相册然后再来这贴
      

  4.   

    要想不报错,你的文件要这样部署
    D:\wamp\www\mysql\show\showUser.php
    D:\wamp\www\mysql\show\server\userServer.php
    D:\wamp\www\mysql\show\entity\user.php
      

  5.   

    你是什么平台,WINDOWS下要用D:\wamp\www\mysql\show\showUser.php,如果是LINUX、UNIX就用D:/wamp/www/mysql/show/showUser.php,另外PHP.INI配置里把路径改成D:/
      

  6.   

    include ("server/userServer.php");
      

  7.   

    include '../server/userServer.php';
      

  8.   

    是路径问题 因为PHP 只能包含一次 结果我多次包含 然后路径就出现了问题。 最好的解决办法 是把所有的PHP 路径写在一个文件 然后只调用这个就可以了。