打开失败,需要'/php';(包括路径=';C:\php5\pear';)
所以我让这个android应用程序连接到数据库,我在php中得到了这个错误 警告:require\u once(/db\u connect.php)[function.require once]:无法打开流:第47行的C:\AppServ\www\android\u connect\viewAllWeb.php中没有此类文件或目录 致命错误:require_once()[function.require]:在C:\AppServ\www\android_connect\viewAllWeb.php的第47行打开必需的'/db_connect.php'(include_path=';C:\php5\pear')失败 这个特定的php应该从我的数据库中调用数据并将其显示为一个表 问题是,我在我的本地主机(使用wamp,没有PEAR,注册全局关闭)中的计算机(假设它是comp1)中尝试了它,它工作正常,即使在我的应用程序中也没有任何错误 但当我把它放在另一台计算机(比如comp2)上,我想把它作为服务器(appserv、PEAR、register global on)时,它显示了这个错误 你知道这是怎么回事吗?我试着在comp2中打开和关闭register global,就像谷歌中的一些建议一样,但没有成功。这与comp1没有梨或其他东西有关吗?因为我是用comp1编写代码的 comp1中的路径是C/wamp/www/android\u connect comp2中的路径是C/AppServ/www/android\u connect 谢谢打开失败,需要'/php';(包括路径=';C:\php5\pear';),php,pear,Php,Pear,所以我让这个android应用程序连接到数据库,我在php中得到了这个错误 警告:require\u once(/db\u connect.php)[function.require once]:无法打开流:第47行的C:\AppServ\www\android\u connect\viewAllWeb.php中没有此类文件或目录 致命错误:require_once()[function.require]:在C:\AppServ\www\android_connect\viewAllWeb.ph
<?php
require "db_connect.php";
//require "get_all_products.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Daftar Barang</title>
<style type="text/css">
<!--
body,td,th {
font-family: Calibri, Verdana, Arial;
}
body {
background-color: #000;
}
-->
</style></head>
<body>
<p> </p>
<table width="80%" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
<tr>
<td><div align="center">
<h1><strong>Daftar Barang</strong></h1>
</div></td>
</tr>
<tr>
<td><table width="98%" border="1" align="center" cellpadding="2" cellspacing="2">
<table border='1'>
<tr>
<th>Serial Number</th>
<th>Label</th>
<th>Jenis</th>
<th>Merk</th>
<th>User</th>
<th>Departemen</th>
<th>Kondisi</th>
</tr>
<?php
$response = array();
// include db connect class
require_once '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// get all products from products table
$result = mysql_query("SELECT * FROM products ORDER BY label") or die(mysql_error());
// check for empty result
if (mysql_num_rows($result) > 0) {
// looping through all results
// products node
$response["products"] = array();
while ($row = mysql_fetch_array($result)) {
$product = array();
$product["SN"] = $row["SN"];
$product["label"] = $row["label"];
$product["jenis"] = $row["jenis"];
$product["merk"] = $row["merk"];
$product["user"] = $row["user"];
$product["dept"] = $row["dept"];
$product["cond"] = $row["cond"];
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row["SN"] . "</td>";
echo "<td>" . $row["label"] . "</td>";
echo "<td>" . $row["jenis"] . "</td>";
echo "<td>" . $row["merk"] . "</td>";
echo "<td>" . $row["user"] . "</td>";
echo "<td>" . $row["dept"] . "</td>";
echo "<td>" . $row["cond"] . "</td>";
echo "</tr>";
}
echo "</table>";
}
// success
$response["success"] = 1;
// echoing JSON response
//echo json_encode($response);
} else {
// no products found
$response["success"] = 0;
$response["message"] = "No products found";
// echo no users JSON
echo json_encode($response);
}
?>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p> </p>
</body>
</html>
达夫塔·巴朗
Daftar Barang
序列号
标签
杰恩斯
梅克
使用者
部门
康迪西
尝试使用require\u once(“db\u connect.php”)
或require\u once(“db\u connect.php”)代码>db_connect.php是否与viewAllWeb.php在同一个文件夹中?是的,它们都在一个文件夹中