試用php中oci8擴展
更新時間:2015年06月18日 10:19:53 投稿:hebedich
這里如何給php開啟oci8的擴展就不講了,小伙伴們自行度娘吧,這里僅僅給大家分享下php操作Oracle的類,有需要的小伙伴可以參考下。
給大家分享個php操作Oracle的操作類
Oracle_db.class.php
<?php
class Oracle_db{
public $link;
public function __construct(){
$this->link=$this->connect();
if(!$this->link){
echo "連接失敗";
exit;
}
}
public function connect(){
return oci_connect('demo','demo','localhost/xe','AL32UTF8');
}
public function execute($sql){
$result=false;
$stid=oci_parse($this->link,$sql);
if($stid){
$result=oci_execute($stid);
}
return array($stid,$result);
}
public function fetch_assoc($stid){
return oci_fetch_assoc($stid);
}
public function fetch_one($stid){
$arr=$this->fetch_assoc($stid);
$this->free($stid);
return $arr;
}
public function fetch_all($stid){
$arr=array();
while($row=$this->fetch_assoc($stid)){
$arr[]=$row;
}
$this->free($stid);
return $arr;
}
public function num_rows($stmt){
return oci_num_rows($stmt);
}
public function error(){
return oci_error($this->link);
}
public function free($stid){
return oci_free_statement($stid);
}
public function server_version(){
return oci_server_version($this->link);
}
public function client_version(){
return oci_client_version();
}
public function __destruct(){
return oci_close($this->link);
}
//
}
以上所述就是本文的全部內(nèi)容了,希望大家能夠喜歡
相關(guān)文章
PHP實現(xiàn)提取一個圖像文件并在瀏覽器上顯示的代碼
去年做過一個項目,要把用戶上傳的圖像文件列出文字清單,當(dāng)用戶點擊一個文件名后,就可以顯示這個圖像.今天有機會重新考慮這個功能,在php手冊中發(fā)現(xiàn)幾行代碼,簡潔明快,完全能實現(xiàn)我要的功能,還不需要GD庫2012-10-10
PHP實現(xiàn)導(dǎo)入大量CSV數(shù)據(jù)的示例代碼
這篇文章主要為大家詳細(xì)介紹了PHP如何實現(xiàn)導(dǎo)入大量CSV數(shù)據(jù)功能,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)PHP有一定幫助,需要的可以參考一下2022-07-07
如何批量替換相對地址為絕對地址(利用bat批處理實現(xiàn))
你的url鏈接是相對路徑你想把他批量替換成絕對路徑該怎么做呢?下面與大家分享下具體的實現(xiàn)思路及代碼,只需點擊bat文件,全部頁面里的相對地址就會變成絕對地址了2013-05-05

