發新話題

[分享] 《PHP》『選項與資訊函式庫』

《PHP》『選項與資訊函式庫』getlastmod --- 取得網頁最後修改的時間

getlastmod ---  取得網頁最後修改的時間

語法 : int getlastmod (void)

說明 :

傳回目前網頁的最後修改的時間,傳回的值是一Unix時間戳記,可以傳遞給date( )使用。發生錯誤則傳回false。

Example :

<?php

    // outputs e.g. 'Last modified: March 04 1998 20:43:59.'

   echo "Last modified: ".date ("F d Y H:i:s.", getlastmod());

?>

參考 : date( )  getmyuid( )  get_current_user( )  getmyinode( )  getmypid( )


TOP

《PHP》『選項與資訊函式庫』getmyinode --- 取得目前程式的inode

getmyinode ---  取得目前程式的inode

語法 : int getmyinode (void)

說明 :

傳回目前程式的inode,失敗則傳回false。

注意 : 此函式無法運作在Windows系統

參考 : getmyuid( )  get_current_user( )  getmypid( )  getlastmod( )

TOP

《PHP》『選項與資訊函式庫』getmypid --- 取得PHP的處理ID

getmypid ---  取得PHP的處理ID

語法 : int getmypid (void)

說明 :

傳回目前PHP處理(process)ID,失敗則傳回false。

參考 : getmyuid( )  get_current_user( )  getmyinode( )  getlastmod( )

TOP

《PHP》『選項與資訊函式庫』getmyuid --- 取得PHP程式擁有者的ID

getmyuid ---  取得PHP程式擁有者的ID

語法 : int getmyuid (void)

說明 :

傳回目前程式的使用者ID,失敗則傳回false。

參考 : getmypid( )  get_current_user( )  getmyinode( )  getlastmod( )

TOP

《PHP》『選項與資訊函式庫』getrusage --- 取得目前資源用法

getrusage ---  取得目前資源用法

語法 : array getrusage ([int who])

說明 :

這是getrusage(2)的界面,它從系統呼叫傳回一組合陣列,如果who為1,getrusage將會呼叫RUSAGE_CHILDREN。

Example :

<?php

    $dat = getrusage();

    echo $dat["ru_nswap"];              # number of swaps

    echo $dat["ru_majflt"];               # number of page faults

    echo $dat["ru_utime.tv_sec"];    # user time used (seconds)

    echo $dat["ru_utime.tv_usec"];  # user time used (microseconds)

?>

TOP

《PHP》『選項與資訊函式庫』phpcredits --- 列出PHP榮譽

phpcredits ---  列出PHP榮譽

語法 : void phpcredits (int flag)

說明 :

此函式列出PHP開發者榮譽(credits)列表,它產生適當的HTML碼,在網頁中插入資訊。參數flag指出將列出何種資訊,例如 : 要列出一般的榮譽,你可以放在你的程式碼的某個地方 :

Example :

<?php

   . . .

  phpcredits(CREDITS_GENERAL);

   . . .

?>

如果你想要列出核心開發者及手冊群組,在網頁中屬於它們自己的地方,你可以使用:

<?php

    phpcredits(CREDITS_GROUP + CREDITS_DOCS + CREDITS_FULLPAGE);

?>

如果你覺得想要將所有的榮譽放在你的網頁中的話,以下的程式碼將可以做到 :

Example :

    <html>

       <head>

           <title>My credits page</title>

       </head>

       <body>

       <?php

            // some code of your own

           phpcredits(CREDITS_ALL + CREDITS_FULLPAGE);

           // some more code

        ?>

        </body>

    </html>

phpcredits( )旗標

名稱                                           說明
CREDITS_ALL                             所有的榮譽,等於使用CREDITS_DOCS + CREDITS_GENERAL + CREDITS_GROUP + CREDITS_MODULES + CREDITS_FULLPAGE。它產生一個完整的獨立的HTML網頁。
CREDITS_DOCS                         手冊團隊的榮譽。
CREDITS_FULLPAGE                  通常是和其它的旗標一起使用,由其它的旗標來指出那些資訊需要完整的獨立的HTML網頁來列出。
CREDITS_GENERAL                   一般的榮譽,語法的設計與觀念,PHP4.0作者與SAPI模組(module)。
CREDITS_GROUP                      核心開發者的列表。
CREDITS_MODULES                  PHP擴充模組的列表,和它們的作者。
CREDITS_SAPI                         有定義此旗標,但是像是PHP 4.0.1pl2,並沒有使用到它。

參考 : phpinfo( )  phpversion( )  php_logo_guid( )

TOP

《PHP》『選項與資訊函式庫』phpinfo --- 輸出PHP資訊

phpinfo ---  輸出PHP資訊

語法 : int phpinfo (void)

說明 :

輸出全部關於目前PHP的狀態的資訊,這包含了關於PHP編譯選項、擴充模組、PHP版本、伺服器資訊和環境、PHP環境、作業平台資訊、路徑、結構(configuration)選項的值、HTTP標頭、GNU Public License。

參考 : phpversion( )  phpcredits( )  php_logo_guid( )

TOP

《PHP》『選項與資訊函式庫』phpversion --- 取得目前PHP版本

phpversion ---  取得目前PHP版本

語法 : string phpversion (void)

說明 :

傳回現在所安裝的PHP的版本。

Example :

<?php

   // prints e.g. 'Current PHP version: 3.0rel-dev'

   echo "Current PHP version: ".phpversion();

?>

參考 : phpinfo( )  phpcredits( )  php_logo_guid( )

TOP

《PHP》『選項與資訊函式庫』php_logo_guid --- 取得logo guid

php_logo_guid ---  取得logo guid

語法 : string php_logo_guid (void)

說明 :

注意 : 此功能是PHP4 Beta 4新增的功能。

參考 : phpinfo( )  phpversion( )  phpcredits( )

TOP

《PHP》『選項與資訊函式庫』php_sapi_name 傳回web伺服與PHP之間的介面型態

php_sapi_name ---  傳回web伺服與PHP之間的介面型態

語法 : string php_sapi_name (void)

說明 :

php_sapi_name( )傳回一個小寫的字串,說明web伺服器與PHP(Server API, SAPI)之間的介面型態。CGI PHP,此字串將會是"cgi";Aapache的mod_php,此字串將會是"apache"等等。

Example :

<?php

   $inter_type = php_sapi_name();

   if ($inter_type == "cgi")

         print "You are using CGI PHP\n";

   else

         print "You are not using CGI PHP\n";

?>

TOP

發新話題

本站所有圖文均屬網友發表,僅代表作者的觀點與本站無關,如有侵權請通知版主會盡快刪除。