abstract class RepositoryBase
{
protected $connection;//This is PDO Object!
public function __construct(PDO $connection = null)
{
$this->connection = $connection;
if ($this->connection === null) {
$this->connection = new PDO(
'mysql:host=localhost:3307;dbname=project',
'root',
'usbw'
);
$this->connection->setAttribute(
PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION
);
}
}
PDOセット名は< UTF8 - どのように私はそれが接続するたびにPDOアダプタをutf8に設定する方法
あなたはhttp://php.net/manual/en/pdoにあなたの答えを見つけることができます.construct.phpおよびhttp://stackoverflow.com/questions/279170/utf-8-all-the-way-through –