都谁在用面向对象的PHP,关于继承!! 换句话说,不能用套用设计模式.这个理由已足以使我从PHP转向JSP了,唉... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我看也没什么,简单是php的一大特点,如果要复杂,干脆用C算了,反正C也不是不能用在web上。我用到的所有功能都没有涉及类。 以下是我写的ORACLE数据库调用的基础类部分谢提供出来供大家参考分析,我觉得基本的继承就足够了<?phpclass orasql{ var $conn=''; function orasql($user,$password,$database) { $conn=OCILogon($user,$password,$database); $this->conn=$conn; return true; } function select($strsql="") { if (empty($strsql))return false; if (empty($this->conn))return false; $conn=$this->conn; $stmt=OCIParse($conn, $strsql); $num=0; $data=array(); $results=OCIexecute($stmt); if ((!$results)or(empty($results))){return false;} while($row=OCIFetch($stmt)) { $data[$num]=$row; $num++; } OCIFreeStatement($stmt); return $data; } function insert($strsql="") { if (empty($strsql))return false; if (empty($this->conn))return false; $conn=$this->conn; $stmt=OCIParse($conn, $strsql); $results=OCIexecute($stmt); if (!$results) return false; OCIFreeStatement($stmt); return $results; } function update($strsql="") { if (empty($strsql))return false; if (empty($this->conn))return false; $conn=$this->conn; $stmt=OCIParse($conn, $strsql); OCIexecute($stmt); $results=OCIexecute($stmt); OCIFreeStatement($stmt); return $results; } function delete($strsql="") { if (empty($strsql))return false; if (empty($this->conn))return false; $conn=$this->conn; $stmt=OCIParse($conn, $strsql); OCIexecute($stmt); $results=OCIexecute($stmt); OCIFreeStatement($stmt); return $results; } }?> 对于OOP的方法归属有点疑惑.高手指教一下吧 正则问题,怎么只匹配一条信息?也就是下面的只要第一条a标记的内容。 刚接触PHP,谁帮忙解决个问题。。 php定时跳转 打家看看。。有没得 逻辑错误。。 怎么用按钮的方式来访问PHP里面的函数? 关于fopen打开url,急 菜鸟求助:提交后,如何得到多选列表中所有的值?——在线等 连接异地ORACLE? 为什么Php4与MySql总是连不上?请救救我!20分奉献! 浏览目录 想要下载与php-mysql-4.2.2-8.0.5.i386.rpm相匹配的phpmysqmin的LINUX版本
谢提供出来供大家参考分析,我觉得基本的继承就足够了
<?php
class orasql
{
var $conn='';
function orasql($user,$password,$database)
{
$conn=OCILogon($user,$password,$database);
$this->conn=$conn;
return true;
}
function select($strsql="")
{
if (empty($strsql))return false;
if (empty($this->conn))return false;
$conn=$this->conn;
$stmt=OCIParse($conn, $strsql);
$num=0;
$data=array();
$results=OCIexecute($stmt);
if ((!$results)or(empty($results))){return false;}
while($row=OCIFetch($stmt))
{
$data[$num]=$row;
$num++;
}
OCIFreeStatement($stmt);
return $data;
}
function insert($strsql="")
{
if (empty($strsql))return false;
if (empty($this->conn))return false;
$conn=$this->conn;
$stmt=OCIParse($conn, $strsql);
$results=OCIexecute($stmt);
if (!$results) return false;
OCIFreeStatement($stmt);
return $results;
}
function update($strsql="")
{
if (empty($strsql))return false;
if (empty($this->conn))return false;
$conn=$this->conn;
$stmt=OCIParse($conn, $strsql);
OCIexecute($stmt);
$results=OCIexecute($stmt);
OCIFreeStatement($stmt);
return $results;
}
function delete($strsql="")
{
if (empty($strsql))return false;
if (empty($this->conn))return false;
$conn=$this->conn;
$stmt=OCIParse($conn, $strsql);
OCIexecute($stmt);
$results=OCIexecute($stmt);
OCIFreeStatement($stmt);
return $results;
}
}
?>