(PHP 4, PHP 5)
set_magic_quotes_runtime — 設置當前 magic_quotes_runtime 配置選項的激活狀態
說明
bool set_magic_quotes_runtime ( bool$new_setting
)
設置當前 magic_quotes_runtime 配置選項的激活狀態。
Warning自 PHP 5.3.0 起,已經廢棄此函數。強烈建議不要應用此函數 。
錯誤/異常
自 PHP 5.3 起,該函數已經被棄用,執行它的時候會拋出 E_DEPRECATED 異常。 自 PHP 5.4 起,嘗試開啟 magic quotes 時該函數會產生一個 E_CORE_ERROR 錯誤。
參數
new_setting
關閉是 FALSE
,開啟是 TRUE
。
返回值
成功時返回 TRUE
, 或者在失敗時返回 FALSE
。
范例
Example #1 set_magic_quotes_runtime() 例子
<?php
// 創建臨時文件指針
$fp = tmpfile();
// 寫入一些數據
fwrite($fp, ''PHP' is a Recursive acronym');
// 沒有 magic_quotes_runtime
rewind($fp);
set_magic_quotes_runtime(false);
echo 'Without magic_quotes_runtime: ' . fread($fp, 64), PHP_EOL;
// 有 magic_quotes_runtime
rewind($fp);
set_magic_quotes_runtime(true);
echo 'With magic_quotes_runtime: ' . fread($fp, 64), PHP_EOL;
// 清理
fclose($fp);
?>
以上例程會輸出:
Without magic_quotes_runtime: 'PHP' is a Recursive acronym With magic_quotes_runtime: 'PHP' is a Recursive acronym
參見
get_magic_quotes_gpc() - 獲取當前 magic_quotes_gpc 的配置選項設置 get_magic_quotes_runtime() - 獲取當前 magic_quotes_runtime 配置選項的激活狀態