本文整理汇总了PHP中Illuminate\Database\MySqlConnection::setFetchMode方法的典型用法代码示例。如果您正苦于以下问题:PHP MySqlConnection::setFetchMode方法的具体用法?PHP MySqlConnection::setFetchMode怎么用?PHP MySqlConnection::setFetchMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\MySqlConnection
的用法示例。
在下文中一共展示了MySqlConnection::setFetchMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFetchMode
/**
* Set the default fetch mode for the connection, and optional arguments for the given fetch mode.
*
* @param int $fetchMode
* @param mixed $fetchArgument
* @param array $fetchConstructorArgument
* @return int
* @static
*/
public static function setFetchMode($fetchMode, $fetchArgument = null, $fetchConstructorArgument = array())
{
//Method inherited from \Illuminate\Database\Connection
return \Illuminate\Database\MySqlConnection::setFetchMode($fetchMode, $fetchArgument, $fetchConstructorArgument);
}
示例2: setFetchMode
/**
* Set the default fetch mode for the connection.
*
* @param int $fetchMode
* @return int
* @static
*/
public static function setFetchMode($fetchMode)
{
//Method inherited from \Illuminate\Database\Connection
return \Illuminate\Database\MySqlConnection::setFetchMode($fetchMode);
}
示例3: PDO
<?php
use BapCat\Persist\Drivers\Local\LocalDriver;
use BapCat\Phi\Phi;
use BapCat\Remodel\Registry;
use BapCat\Remodel\EntityDefinition;
use BapCat\Session\DatabaseSessionServiceProvider;
use BapCat\Session\SessionManager;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\MySqlConnection;
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/DoItUserAuthorizer.php';
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$connection = new MySqlConnection($pdo, 'test');
$connection->setFetchMode(PDO::FETCH_ASSOC);
$ioc = Phi::instance();
$ioc->bind(ConnectionInterface::class, $connection);
// Grab filesystem directories
$persist = new LocalDriver(__DIR__ . '/..');
$cache = $persist->getDirectory('/cache');
$registry = new Registry($ioc, $cache);
$sp = new DatabaseSessionServiceProvider($ioc, $registry);
$sp->register();
$sp->boot();
$session = $ioc->make(SessionManager::class);
$session->open();
$auth = new DoItUserAuthorizer($session);