php 5.3 ereg_替换为preg_替换
我有一个应用程序在从PHP5.2迁移到PHP5.3后无法工作 即使在我将上面的ereg_替换行更改为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 ,
$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;