1thinkphp指定其他数据库
系统:win xp
wamp:2.1 (php5.3.5+apache2.2.17+mysql5.5.8)thinkphp:2.1
--------------------------------------------------
[db]
host:127.0.0.1
name:test
user:root
password:123456
[Action/TestAction.class.php]
class TestAction extends Action{
}
[model/WzgTestModel.class.php]
class WzgTestModel extends Model {
}
--------------------------------------------------
thinkphp相关代码
(1)ThinkPHP/Lib/Think/Core/Model.class.php
(2)ThinkPHP/Lib/Think/Db/Db.class.php
thinkphp发现的bug
(1)ThinkPHP/Lib/Think/Db/Db.class.php 321行
原代码
preg_match('/^(.*?)\:\/\/(.*?)\:(.*?)\@(.*?)\:([0-9]{1, 6})\/(.*?)$/',trim($dsnStr),$matches);
更改后(“{1, 6}”之间的空格去掉)
preg_match('/^(.*?)\:\/\/(.*?)\:(.*?)\@(.*?)\:([0-9]{1,6})\/(.*?)$/',trim($dsnStr),$matches);