FuelPHP从1.7.2升级到1.8.1后,查询生成器中出现编译错误
在将PHP从5.5升级到7.1以及将FuelPHP从1.7.2升级到1.8.1之后,我在编译方法中遇到了以下“无效数据源名称”错误FuelPHP从1.7.2升级到1.8.1后,查询生成器中出现编译错误,php,fuelphp,Php,Fuelphp,在将PHP从5.5升级到7.1以及将FuelPHP从1.7.2升级到1.8.1之后,我在编译方法中遇到了以下“无效数据源名称”错误 [FATAL] index.php <:63> : [2018/06/08 02:47:26] invalid data source name [FATAL] index.php <:64> : [2018/06/08 02:47:26] Array ( [0] => Array ( [
[FATAL] index.php <:63> : [2018/06/08 02:47:26] invalid data source name
[FATAL] index.php <:64> : [2018/06/08 02:47:26] Array
(
[0] => Array
(
[file] => /var/www/fuel/core/classes/database/pdo/connection.php
[line] => 434
[function] => connect
[class] => Fuel\Core\Database_PDO_Connection
[type] => ->
[args] => Array
(
)
)
・・・
但下面的内容失败了
$query = DB::select('*')->from('table_name');
$query->where('column_name', 'hogehoge');
$sql = $query->compile('my_db_connection');
如何解决此错误?检查您的数据库设置。
Fuel需要一个正确的DB连接才能跳出where()的参数。很抱歉,我提出了一个错误的解决方案
$query = DB::select('*')->from('table_name');
$query->where('column_name', 'hogehoge');
$sql = $query->compile('my_db_connection');