<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
<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
如果A include B, B include C, A是显示页面,那么B中include也要用相对于A的路径。
电脑是不会说谎的,所以仔细检查核对。
将图片传到CSDN的相册然后再来这贴
D:\wamp\www\mysql\show\showUser.php
D:\wamp\www\mysql\show\server\userServer.php
D:\wamp\www\mysql\show\entity\user.php