Recently suddenly thought of oci_8 expansion, a development of PHP, there are many functions, turned the manual, looked at the thinkphp db and dboracle driver files
That's what Oci_connect and Oci_pconnect, and the source of Oci_new_connect.
The code is as follows
/** * Connecting Database methods * @access public */ public function connect ($config = ", $linkNum =0) { if ( !isset ($this->linkid[$linkNum]) ) { if (Empty ($config)) $config = $this->config; $ Pconnect = !empty ($config [' params '] [' persist '])? $config [' params '] [' persist ']:$ this->pconnect; $conn = $ pconnect ? ' oci_pconnect ': ' Oci_new_connect '; $this->linkid[$linkNum] = $conn ($config [' username '], $config [' Password '],$ config[' database '],c ('Db_charset '));//modify by wyfeng at 2008.12.19 if (! $this->linkid[$linkNum]) { $this->error (false); }//here are two functions Oci_pconnect and Oci_new_connect are in the oci8 extension, Oci_connect is also//For example: $ Conn = oci_connect (' System ', ' Oracle ', ' 192.168.109.132:49161/xe ');//192.168.109.132:49161/xe---> This string connection is a simple connection and requires more than oracle10g to use the//full Oracle Net connection string to provide sufficient connectivity flexibility. $db = MYDB2 = (description =//(address = (PROTOCOL = TCP)//( Host = mymachine.mydomain) (port = 1521))//(connect_data=//(server = dedicated)// (Service_name = mydb. AU. oracle.com)) ';//oci8 extensions always need to find Oracle libraries and message files. Unable to find the correct file will cause PHP return oracle "Ora-12705:cannot acceSs nls data files or invalid environment specified ". // Mark Connection Success $this->connected = true; //Log Off database security information if (1 != c (' Db_deploy_type ')) unset ($this->config); } return $this->linkid[$ linknum]; }
Not to build wheels, but to understand how other people are organizing the original writing, I think thinkphp some of the processing is good.
Recently began to feel Oci_8 's function can look at the manual to try. A new feeling will be written here.
This article is from the "one-stop solution" blog, so be sure to keep this source http://10725691.blog.51cto.com/10715691/1953081
The application of PHP extension oci8 on thinkphp