国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

基于PHP選項與信息函數的使用詳解

2024-05-04 21:53:38
字體:
來源:轉載
供稿:網友
bool assert ( mixed $assertion [, string $description ] ) ― 檢查一個斷言是否為 FALSE
復制代碼 代碼如下:www.CuoXIn.com

assert_options(ASSERT_ACTIVE, true);//允許使用assert()函數
assert_options(ASSERT_WARNING, false);//在assert失敗時不輸出警告信息
assert_options(ASSERT_BAIL, true);//assert失敗后終止代碼執行
assert_options(ASSERT_CALLBACK, 'getMsg');//assert失敗后終止代碼執行。

echo '開始:<br/>';
assert(' echo '測試成功!';

function getMsg(){
echo '出錯啦!';
}

mixed assert_options ( int $what [, mixed $value ] ) ― 設置 assert() 的各種控制
選項,或者查詢當前的設置
ASSERT_ACTIVE : 是否啟用 assert() 斷言, ini配置 assert.active,默認值 1
ASSERT_WARNING :是否為每個失敗的斷言產生一個 PHP 警告,ini配置 assert.warning,默認1
ASSERT_BAIL :是否在斷言失敗時中止執行,ini配置 assert.bail,默認值0
ASSERT_QUIET_EVAL :是否在斷言表達式求值時禁用 error_reporting,ini配置assert.quiet_eval,默認值0
ASSERT_CALLBACK :斷言失敗時調用回調函數,ini配置assert.callback
復制代碼 代碼如下:www.CuoXIn.com

assert_options(ASSERT_ACTIVE, true);//允許使用assert()函數
assert_options(ASSERT_WARNING, false);//在assert失敗時不輸出警告信息
assert_options(ASSERT_BAIL, true);//assert失敗后終止代碼執行
assert_options(ASSERT_CALLBACK, 'getMsg');//assert失敗后終止代碼執行。

echo '開始:<br/>';
assert(is_int(1.2));//檢測結果為fales
echo '測試成功!';

function getMsg(){
echo '出錯啦!';
}

bool dl( string $library ) ― 獲取 PHP 配置選項的值 載入指定的 PHP擴展
復制代碼 代碼如下:www.CuoXIn.com

if(!extension_loaded('sqlite')){//測試指定的擴展是否已經激活
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? ' dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);
}

int gc_collect_cycles() ― 強制收集所有現存的垃圾循環周期
void gc_disable ( void ) ― 停用循環引用收集器
void gc_enable ( void ) ― 激活循環引用收集器
bool gc_enabled ( void ) ― 返回循環引用計數器的狀態
string get_cfg_var ( string $option ) ― 獲取 PHP 配置選項的值獲取 PHP 配置選項的值
string get_current_user ( void )― 獲取當前 PHP 腳本所有者名稱
array get_defined_constants ([ bool $categorize = false ] )― 返回所有常量的關聯數組
array get_extension_funcs ( string $module_name )― 返回模塊函數名稱的數組
復制代碼 代碼如下:www.CuoXIn.com

string get_include_path ( void ) ― 獲取當前的 include_path 配置選項
array get_included_files ( void )― 返回被 include 和 require 文件名的 array
復制代碼 代碼如下:www.CuoXIn.com

include 'test1.php';
include_once 'test2.php';
require 'test3.php';
require_once 'test4.php';

$included_files = get_included_files();

foreach ($included_files as $filename){
echo "$filename/n";
}

array get_loaded_extensions ([ bool $zend_extensions = false ] )― 返回所有編譯并加載模塊名的 array
bool get_magic_quotes_gpc ( void )― 獲取當前 magic_quotes_gpc 的配置選項設置
bool get_magic_quotes_runtime ( void ) ― 獲取當前 magic_quotes_runtime 配置選項的激活狀態
string getenv ( string $varname ) ― 獲取一個環境變量的值
復制代碼 代碼如下:www.CuoXIn.com

$ip = getenv('REMOTE_ADDR');

int getlastmod ( void )― 獲取頁面最后修改的時間
int getmygid ( void )― 獲取當前 PHP 腳本擁有者的 GID
int getmyinode ( void )― 獲取當前腳本的索引節點(inode)
int getmypid ( void )― 獲取 PHP 進程的 ID
int getmyuid ( void )― 獲取 PHP 腳本所有者的 UID
array getopt ( string $options [, array $longopts ] )― 從命令行參數列表中獲取選項
array getrusage ([ int $who = 0 ] ) ― 獲取當前資源使用狀況
array ini_get_all ([ string $extension [, bool $details = true ]] ) ― 獲取所有配置選項
復制代碼 代碼如下:www.CuoXIn.com

print_r(ini_get_all("pcre"));
print_r(ini_get_all());

string ini_get ( string $varname ) ― 獲取一個配置選項的值
void ini_restore ( string $varname )― 恢復配置選項的默認值
string ini_set ( string $varname , string $newvalue )― 為一個配置選項設置值
main ― 虛擬的 main()int memory_get_peak_usage ([ bool $real_usage = false ] )― 返回分配給 PHP 內存的峰值int memory_get_usage ([ bool $real_usage = false ] ) ― 返回分配給 PHP 的內存量
string php_ini_loaded_file ( void ) ― 取得已加載的 php.ini 文件的路徑
string php_ini_scanned_files ( void )― 返回從額外 ini 目錄里解析的 .ini 文件列表
string php_sapi_name ( void ) ― 返回 web 服務器和 PHP 之間的接口類型
string php_uname ([ string $mode = "a" ] )― 返回運行 PHP 的系統的有關信息
'a':此為默認all。
's':操作系統名稱
'n':主機名。例如: localhost.example.com。
'r':版本名稱,例如: 5.1.2-RELEASE。
'v':版本信息。操作系統之間有很大的不同。
'm':機器類型。例如:i386。
bool phpcredits ([ int $flag = CREDITS_ALL ] ) ― 打印 PHP 貢獻者名單
CREDITS_ALL :所有的
CREDITS_DOCS : 文檔組貢獻名單
CREDITS_FULLPAGE : 常用于和其他標志進行組合。 表示需要打印包含其他標志表示信息的獨立 HTML 頁面。
CREDITS_GENERAL : 普遍名單:語言設計與理念、PHP作者以及 SAPI 模塊
CREDITS_GROUP : 核心開發者名單
CREDITS_MODULES : PHP 擴展模塊以及作者
CREDITS_SAPI : PHP 的服務器 API 模塊以及作者
復制代碼 代碼如下:www.CuoXIn.com

phpcredits(CREDITS_GROUP | CREDITS_DOCS | CREDITS_FULLPAGE);

bool phpinfo ([ int $what = INFO_ALL ] ) ― 輸出關于 PHP 配置的信息
string phpversion ([ string $extension ] ) ― 獲取當前的PHP版本
bool putenv ( string $setting )― 設置環境變量的值
void restore_include_path ( void ) ― 還原 include_path 配置選項的值
string set_include_path ( string $new_include_path ) ― 設置 include_path 配置選項
void set_time_limit ( int $seconds )― 設置腳本最大執行時間,從它本身開始計時,0表示不限時
string sys_get_temp_dir ( void ) ― 返回用于臨時文件的目錄
mixed version_compare ( string $version1 , string $version2 [, string $operator ] ) ― 對比兩個PHP 規范化的版本數字字串
復制代碼 代碼如下:www.CuoXIn.com

if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
echo '我的PHP版本很高: ' . PHP_VERSION . "/n";
}

int zend_thread_id ( void ) ― 返回當前線程的唯一識別符
string zend_version ( void ) ― 獲取當前 Zend 引擎的版本

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 分宜县| 澄城县| 惠州市| 吕梁市| 刚察县| 雷波县| 土默特左旗| 象山县| 吕梁市| 宿松县| 综艺| 西贡区| 萨嘎县| 上杭县| 茶陵县| 广州市| 苏尼特左旗| 巫山县| 内黄县| 通化市| 轮台县| 鸡泽县| 壤塘县| 繁峙县| 高平市| 洪湖市| 阆中市| 新闻| 昌都县| 普洱| 翼城县| 墨江| 株洲市| 定远县| 临江市| 蓬安县| 镇赉县| 铜鼓县| 化州市| 若尔盖县| 肃宁县|