2012-10-11 48 views
1
$this->Settings = array("host" => $host , "user" => $user , "pass" => $pass); 
    $this->db = $db; 
    $this->Settings["name"] = ereg_replace ("_", "", $this->db); 
    $this->init(); 

我有一个应用程序,从php 5.2迁移到php 5.3后无法工作。php 5.3 ereg_replace到preg_replace

即使我改变了上面

$this->aSettings["name"] = preg_replace("/_/", "", $this->db);

它仍然没有从数据库获取的设置ereg_replace线。

+0

如果问题是未从数据库中检索到该值,那么问题出在您的'$ db'变量中。尝试检查它的值:'var_dump($ db)' – pankar

回答

3

为什么你的preg_replace()不起作用没有什么特别的理由,但你可以简单地使用str_replace()

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

这种说法让我感兴趣的,但:

$this->db = $db; 

哪里是$db集?遵循该步骤,直到找到真正的问题所在,

+0

谢谢。是的..这不是问题。即使错误报告设置为全部,也很难追踪,因为没有错误。 –

+0

@PotentialCoder然后你需要分享更多的代码,否则无法帮助你。 –