本文共 542 字,大约阅读时间需要 1 分钟。
1.确认php支持oci
2.建立测试页
<?
$dbconn = oci_connect('crmtest','123456',"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=114.1.12.12)(PORT=1521))(CONNECT_DATA=(SID=orc1)))"); if ($dbconn) { echo '连接成功'; }else { echo '连接失败'; } ?>pdo连接mysql测试:
<?php
try {
$dbh = new PDO('mysql:host=10.4.1.103;dbname=ku', ku, 123456);
foreach ($dbh->query('SELECT * from sns_topic') as $row) {
print_r($row);
}
catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>