Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.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 5.3 ereg_替换为preg_替换_Php_Preg Replace_Ereg Replace - Fatal编程技术网

php 5.3 ereg_替换为preg_替换

php 5.3 ereg_替换为preg_替换,php,preg-replace,ereg-replace,Php,Preg Replace,Ereg Replace,我有一个应用程序在从PHP5.2迁移到PHP5.3后无法工作 即使在我将上面的ereg_替换行更改为 $this->aSettings[“name”]=preg\u replace(“/”、“,$this->db”) 它仍然无法从数据库中获取设置。您的preg\u replace()没有特别的原因无法工作,但是您可以简单地使用str\u replace() $this->Settings = array( "host" => $host , "user" => $user ,

我有一个应用程序在从PHP5.2迁移到PHP5.3后无法工作

即使在我将上面的ereg_替换行更改为

$this->aSettings[“name”]=preg\u replace(“/”、“,$this->db”)


它仍然无法从数据库中获取设置。

您的
preg\u replace()
没有特别的原因无法工作,但是您可以简单地使用
str\u replace()

$this->Settings = array( "host" => $host , "user" => $user , "pass" => $pass );
    $this->db = $db;
    $this->Settings["name"] = ereg_replace  ("_", "", $this->db);
    $this->init();
不过,我对这句话很感兴趣:

$this->Settings['Name'] = str_replace('_', '', $this->db);

$db
设置在哪里?遵循这条线索,直到找到真正的问题所在。

如果问题是没有从数据库中检索到值,那么问题就出在
$db
变量中。尝试检查其值:
var\u dump($db)
谢谢。是 啊这不是问题所在。很难跟踪,因为即使将“错误报告”设置为“全部”,也没有错误。@PotentialCoder您需要共享更多的代码,否则无法帮助您。
$this->db = $db;