function test()
{
$tns = "
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 2521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
";
$username = "username";
$password = "password";
$conn = new \PDO('oci:dbname=' . $tns . ';charset=ZHS16GBK', $username, $password);
try {
$sql = "select 1 from dual";
$rs = $conn->prepare($sql);
$rs->execute();
$id = $rs->fetch();
var_dump($id);
} catch (Exception $e) {
var_dump($e->getMessage());
}
}