mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )
pattern
要搜索的模式. 可以使一个字符串或字符串数组.
mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )
pattern
要搜索的模式. 可以使一个字符串或字符串数组.
先来简单了解get_headers()函数
get_headers() 返回一个数组,包含有服务器响应一个 HTTP 请求所发送的标头。
PHP函数split()的基本语法为
array split ( string $pattern, string $string [, int $limit] )。
提示:mb_substr在于php中是默认不被支持的我们需要在在windows目录下找到php.ini打开编辑,搜索mbstring.dll,找到;extension=php_mbstring.dll把前面的;号去掉才可以使用mb_substr函数哦。
发送一个原始 HTTP 标头[Http Header]到客户端。标头 (header) 是服务器以 HTTP 协义传 HTML 资料到浏览器前所送出的字串,在标头与 HTML 文件之间尚需空一行分隔
函数用法
int preg_match_all ( string pattern, string subject, array matches [, int flags] )
htmlentities用法
$str = "John & 'Adams'";
echo htmlentities($str, ENT_COMPAT);
echo "
";
echo htmlentities($str, ENT_QUOTES);
echo "
";
echo htmlentities($str, ENT_NOQUOTES);
?>
iconv不是php的默认函数,也是默认安装的模块。需要安装才能用的。
如果是windows2000+php,你可以修改php.ini文件,将extension=php_iconv.dll前的";"去掉,同时你要copy你的原php安装文件下的iconv.dll到你的winnt/system32下
在magic_quotes_gpc=On的情况下,如果输入的数据有
单引号(’)、双引号(”)、反斜线()与 NUL(NULL 字符)等字符都会被加上反斜线。这些转义是必须的,如果这个选项为off,那么我们就必须调用addslashes这个函数来为字符串增加转义。
定义和用法
explode() 函数把字符串分割为数组。
格式化日期
date() 函数的第一个参数规定了如何格式化日期/时间。它使用字母来表示日期和时间的格式。这里列出了一些可用
的字母:
function array_to_json($array) {
if (! is_array ( $array )) {
return false;
}
$associative = count ( array_diff ( array_keys ( $array ), array_keys ( array_keys ( $array ) ) ) );
if ($associative) {
$construct = array ();
foreach ( $array as $key => $value ) {
// We first copy each key/value pair into a staging array,
// formatting each key and value properly as we go.