本人想学PHP,可看到网上说PHP已经不更新了.=============================引用================
PHP 官方宣布将在年底结束 PHP 4 的新版本开发。也就是说,在 2007 年 12 月 31 日之后,PHP 4 将不会再有新的版本。同时 PHP 官方也承诺在 2008 年 8 月 8 日(他们也要看北京奥运会??)之前,对于严重的安全漏洞还会进行维护和修复,在这之后,PHP 4 将彻底告别历史舞台。PHP 4 作为 PHP 历史上一个里程碑式的版本,为 PHP 的发展可谓做出了巨大的贡献。在 PHP 4 这个健壮的语言平台上,出现了 phpBB,WordPress,Drupal 等等优秀的 Web 应用。而由于这些应用的广泛使用,使得 PHP 也成为了互联网中应用最为广泛、最为流行的动态脚本语言。=================================================是不是这样啊?那PHP彻底告别历史舞台,还学干什么啊?再学不就等于是考古的吗我不要考古!!!
PHP 官方宣布将在年底结束 PHP 4 的新版本开发。也就是说,在 2007 年 12 月 31 日之后,PHP 4 将不会再有新的版本。同时 PHP 官方也承诺在 2008 年 8 月 8 日(他们也要看北京奥运会??)之前,对于严重的安全漏洞还会进行维护和修复,在这之后,PHP 4 将彻底告别历史舞台。PHP 4 作为 PHP 历史上一个里程碑式的版本,为 PHP 的发展可谓做出了巨大的贡献。在 PHP 4 这个健壮的语言平台上,出现了 phpBB,WordPress,Drupal 等等优秀的 Web 应用。而由于这些应用的广泛使用,使得 PHP 也成为了互联网中应用最为广泛、最为流行的动态脚本语言。=================================================是不是这样啊?那PHP彻底告别历史舞台,还学干什么啊?再学不就等于是考古的吗我不要考古!!!
而且PHP也不能算是语言,就算是面向对象,好象也是假的吧.不会象.NET?想了解一下
PHP是个脚本,脚本怎么面向对象??
如果说 PHP 是严格解释的而 ASP.NET 代码是编译的,则有点误导 — 正如我刚刚介绍的通用语言运行时环境所证实的那样。此外,通过 PHP 以及 ASP.NET 页面,您可以配置您的各个 Web 服务器来执行这些页面的连接池和高速缓存,因此不需要每次都重新编译它们。毫无疑问,PHP 页面将编译成比等价的 ASP.NET 页面更小的部分,这是因为 CLR 中间编译的开销更大。最后,这将导致 Web 服务器产生更高的内存需求。=========
毫无疑问,PHP 页面将编译成比等价的 ASP.NET 页面更小的部分,这是因为 CLR 中间编译的开销更大。最后,这将导致 Web 服务器产生更高的内存需求。
* 普通数据库表管理类
*数据库的CRUD操作
* $fields为数组,比如$fields["id"]=1
*/
class TableManager {
private $tableName,$fields,$conn;
public function __construct($con){
$this->fields = array();
$this->conn=$con;
}
public function __destruct(){
}
public function getConn(){
return $this->conn;
}
public function getTableName(){
return ($this->tableName);
}
public function setTableName($value){
$this->tableName=$value;
}
public function getFields(){
return ($this->fields);
}
public function setFields($value){
$this->fields=$value;
}
//添加新的数据库记录
public function saveNew()
{
//一个空的纪录集合
$rs=$this->conn->Execute("SELECT * FROM ".$this->tableName);
$insertSQL = $this->conn->GetInsertSQL($rs, $this->fields);
$this->conn->Execute($insertSQL);
}
//修改数据库记录
public function update($fieldName,$fieldValue)
{
$rs=$this->conn->Execute("SELECT * FROM ".$this->tableName." where ".$fieldName."=".$fieldValue);
$updateSQL = $this->conn->GetUpdateSQL($rs, $this->fields);
$this->conn->Execute($updateSQL); # 更新资料库中的记录
}
public function updateRecords($sqlWhere){
$rs=$this->conn->Execute("SELECT * FROM ".$this->tableName." where ".$sqlWhere);
$updateSQL = $this->conn->GetUpdateSQL($rs, $this->fields);
$this->conn->Execute($updateSQL); # 更新资料库中的记录
}
public function delete(){}
}
//上传文件类
class UploadFiler{
private $uploadFile,//数组,上传文件的信息$_file
$uploadDir,//存放路径
$uploadError;//上传文件的错误信息
//产生新的文件名,后缀名不变
public function __construct($uploadFileInfo){
$this->uploadFile=$uploadFileInfo;
$this->uploadError="";
}
private function getNewFileName($oldName)
{
return strtotime("now").rand().strrchr($oldName,".");
}
public function setUploadFile($uploadFileInfo){
$this->uploadFile=$uploadFileInfo;
}
public function getUploadFile(){
return $this->uploadFile;
}
public function setUploadDir($uploadDirV){
$this->uploadDir=$uploadDirV;
}
public function getUploadDir(){
return $this->uploadDir;
}
public function getUploadError(){
return $this->uploadError;
}
public function setUploadError($uploadErrorV){
$this->uploadError=$uploadErrorV;
}
public function uploadFile(){
$tempName=$this->uploadDir.$this->getNewFileName($this->uploadFile["name"]) ;
if (!move_uploaded_file($this->uploadFile["tmp_name"],$tempName)) {
$this->uploadError=$this->uploadFile["name"].":文件上传出现错误。";
return 1;
}
else $this->uploadFile["name"]=$tempName;
return 0;
}
}
//带图片上传数据库表管理类
class PicTableManager extends TableManager {
private $uploadFiles;//数组,保存图片路径字段.
//数组结构:$uploadFiles["uploadFieldName"]=uploadFileObj;
public function __construct($con){
parent::__construct($con);
$this->uploadFiles=array();
}
public function __destruct(){}
public function setUploadFiles($uploadFilesV){
$this->uploadFiles=$uploadFilesV;
}
public function getUploadFilesV(){
return $this->uploadFilesV;
}
//上传图片方法
private function uploadFiles()
{
foreach ($this->uploadFiles as $uploadObj) {
$uploadObj->uploadFile();
}
}
//删除上传的图片,修改过的图片
public function delUploadedFile($fieldName,$fieldValue)
{
$conn=$this->getConn();
$sqlString="SELECT * FROM ".$this->getTableName()."where ".$fieldName."=".$fieldValue;
$rs=$conn->Execute($sqlString);
foreach ($this->uploadFiles as $uploadFieldName=>$uploadFileObj) {
if (file_exists($rs[$uploadFieldName])) {
unlink($rs[$uploadFieldName]);//删除文件
}
}
}
//覆写保存新纪录的方法
public function saveNew()
{
$this->uploadFiles();
$tempFields=$this->getFields();
//
foreach ($this->uploadFiles as $uploadFieldName=>$uploadFileObj){
if (!$uploadFileObj->uploadFile()) {
$tempFields[$uploadFieldName]=$uploadFileObj["name"];
}
}
$this->setFields($tempFields);
parent::saveNew();
}
//覆写修改纪录的方法
public function update($fieldName,$fieldValue)
{
$this->delUploadedFile($fieldName,$fieldValue);//删除对应纪录的有关修改过的老图片
$this->uploadFiles();
foreach ($this->uploadFiles as $uploadFileTableName=>$uploadFileObj){
if (!$uploadFileObj["error"]) {
$tempFields[$uploadFileTableName]=$uploadFileObj["name"];
}
}
$this->setFields($tempFields);
parent::update($fieldName,$fieldValue);
}
public function delete()
{}
}
默认不就是PUBLIC吗??
http://community.csdn.net/Expert/topic/5664/5664324.xml?temp=.456402
而php*系列会一直发展下去的.
php是一门优秀的语言,选择它,没错的.!~