0
0

More than 1 year has passed since last update.

PHPで名前空間内でPDOを使う方法

Posted at

PHPで名前空間内でPDOを使うには、次のように記述します。

namespace YourNameSpace {
    use PDO;
    // ...

    $pdo = new PDO(...);
    // ...
}

このように、名前空間内でuse構文を使用してPDOクラスをインポートし、その後にPDOオブジェクトを生成することができます。

注意:PDO拡張モジュールがPHPにインストールされていることが前提となります。また、接続文字列(. . .の部分)は適切なものに置き換えてください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0