Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 梨不是';t工作正常:致命错误:Class';PEAR#u错误';找不到_Php_Database_Xampp_Pear - Fatal编程技术网

Php 梨不是';t工作正常:致命错误:Class';PEAR#u错误';找不到

Php 梨不是';t工作正常:致命错误:Class';PEAR#u错误';找不到,php,database,xampp,pear,Php,Database,Xampp,Pear,我有xampp,我写了以下代码: <!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" con

我有xampp,我写了以下代码:

    <!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=utf-8" />
<title>pear</title>
</head>

<body>
<?php
require 'DB.php';
$db = DB::connect('mysql://root@localhost/asd');
$query = "select * from asd";
$result = $db->query($query);
 while($raw = $result->fetchRow(DB_FETCHMODE_ASSOC))
 {
 echo $row['1'] , " ";
echo $raw['2'], "<br>";
 }

?>
</body>
</html>

我重新安装了“DB”,并检查了pear是否已安装且一切正常。

这不是一个直接的解决方案,但我建议您离开pear的DB,切换到PDO。它与您现在所做的非常相似,并且得到了很好的支持,因为它是PHP的一部分


在这里可以找到一个很好的快速入门指南:

可能会对您有所帮助:我已经看到了这一点,这不是问题所在,现在我在“DB.PHP”文件中进行了搜索,但没有找到名为“pear_Error”的函数或类,非常感谢。我用“DB”来做这件事是因为我从一本书上学到了他们说要做的事。这有点过时了。PDO是目前为止最好的选择。这很好,因为它允许您对所有数据库系统使用相同的PHP代码,并且易于安装。祝你好运
Fatal error: Class 'PEAR_Error' not found in C:\xampp\php\pear\DB.php on line 947.