1. foreach()foreach()是一個用來遍曆數組中資料的最簡單有效方法。#example1:複製代碼 代碼如下:$colors= array('red','blue','green','yellow');foreach ($colorsas$color){echo "Do you like $color? ";}?>顯示結果:Do you like red? Do you like blue? Do you like green? Do you like yellow?2.
今天啟動apache2始終無法啟動,本以為又是連接埠問題,可後來查看並未有連接埠佔用問題,於是查看錯誤記錄檔如下:[Sat Jun 20 03:12:52 2009] [notice] Apache/2.2.11 (Win32) PHP/5.2.9-2 configured -- resuming normal operations[Sat Jun 20 03:12:52 2009] [notice] Server built: Dec 10 2008 00:10:06[Sat Jun 20 0
先談parent與self:複製代碼 代碼如下:/* * Created by YinYiNiao */ class A{ function __construct(){ echo "基類A的構造方法"; } } class B extends A{ function __construct(){ parent::__construct(); echo "子類B的構造方法"; self::myFun(); } function myfun(){ echo
大量SmipleXML函數可用來載入和解析大量XML文檔。--------------------------------------------------------------------------------1.simpleXML_load_file()函數來載入指定的XML檔案到對象。如果負載檔案時遇到問題,則返回FLASE。例:book.xml檔案:複製代碼 代碼如下: Pride and Prejudice Jane Austen Jane Austen's most
預設情況下,大多數web伺服器一般被配置為匿名訪問,也即為,使用者在訪問伺服器上的資訊時一般不會被要求提示標識資訊。匿名訪問意味著使用者不使用使用者名稱和密碼登陸就可以訪問網站。這也是絕大多數公用網站所使用的配置。在Apache的設定檔“httpd.conf”中,預設被配置為匿名訪問(如下):複製代碼 代碼如下: Options Indexes FollowSymLinks Includes AllowOverride None Order allow,deny Allow from
header() is used to send raw HTTP headers. See the HTTP/1.1 specification for more information on HTTP headers. 範例一: 複製代碼 代碼如下:Header("Location: http://www.jb51.net";); exit;//在每個重新導向之後都必須加上“exit",避免發生錯誤後,繼續執行。?>複製代碼 代碼如下:header("refresh:2;url=http:/
如下所示:複製代碼 代碼如下:/** * 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 is 1
複製代碼 代碼如下: class Cart{ public function Cart(){ echo "正在調用Cart()"; } public function doSomething(){ echo "正在調用doSomethimg()"; } } class Named_Cart extends Cart{ function Named_Cart(){ echo "正在調用Named_Cart()"; } function doSomething(){