注意:不像其他的物件導向程式設計語言,在php中,類不能對某個屬性變數使用final修飾符。如果要聲明某個屬性為常量,可以使用const關鍵字,並且無需使用貨幣符號作為變數名首碼,也無需使用存取權限修飾符。常量意味著雖然可以訪問該變數,但不能修改該變數的值。例如下邊的代碼聲明了常量屬性con_var:複製代碼 代碼如下:<?phpclass Foo{ const con_var="常量屬性的值不能被修改<br />"; public function method_a(){
說明:Linux伺服器系統:CentOS 5.5Web環境:LAMP或者LNMPWindows伺服器系統:Windows Server 2003Windows伺服器IP地址:192.168.21.134資料庫環境:SQL Server 2000資料庫資料庫帳號:sa資料庫密碼:123456實現目的:Linux伺服器中的php程式能夠串連到Windows伺服器中的SQL Server 2000資料庫具體步驟:一、在Linux伺服器中安裝freetds1、安裝編譯工具及驅動程式yum
如下所示:複製代碼 代碼如下:<?/** * xml2array() will convert the given XML text to an array in the XML structure. * Link: http://www.bin-co.com/php/scripts/xml2array/ * Arguments : $contents - The XML text * $get_attributes - 1 or 0. If this
先談parent與self:複製代碼 代碼如下:<?php/* * Created by YinYiNiao */ class A{ function __construct(){ echo "基類A的構造方法<br />"; } } class B extends A{ function __construct(){ parent::__construct(); echo "子類B的構造方法<br />"; self::myFun(); }
代碼如下所示:複製代碼 代碼如下:<?class GifMerge { var $ver = '1.1'; var $dly = 50; var $mod = 'C_FILE'; var $first = true; var $use_loop = false; var $transparent = false;
header() is used to send raw HTTP headers. See the HTTP/1.1 specification for more information on HTTP headers. 範例一: 複製代碼 代碼如下:<?PHPHeader("Location: http://www.jb51.net";); exit;//在每個重新導向之後都必須加上“exit",避免發生錯誤後,繼續執行。?>複製代碼