laravel DB::connection()->getPdo()::PARAM_STR 不工作

laravel DB::connection()->getPdo()::PARAM_STR not working

函数 getPdo() with PARAM_STR in laravel

DB::connection()->getPdo()::PARAM_STR

在 php 7.0.0 上工作正常,但在 php 5.6.16 或更低版本上不工作。如何从 laravel 中 php 5.6.16 或更低版本的 PDO 实例获取 PARAM_STR?

我试过了

DB::connection()->getPdo()->PARAM_STR

但对我不起作用..

对我有用的解决方案是这个..

static function db ()
    {
        try {
            $db = DB::connection()->getPdo();
        }
        catch (PDOException $e) {
            self::fatal(
                "An error occurred while connecting to the database. ".
                "The error reported by the server was: ".$e->getMessage()
            );
        }
        return $db;
    }

通过调用..

$db=self::db();

$db::PARAM_STR

我解决了。所有里面 class & 方法