您的位置:首页 > 编程语言 > PHP开发

一些PHP中之前没见到过的知识点收集

2011-11-27 01:53 483 查看
$_SERVER["PHP_SELF"]  表示当前运行的PHP文件名

ini_get  Gets
the value of a configuration option  php.ini 中的配置值

mb_internal_encoding Set/Get
internal character encoding   有参数则是set, 没有参数是

mb_substr Get
part of string

Performs
a multi-byte safe substr() operation
based on number of characters. Position is counted from the beginning of str.First
character's position is 0. Second character position is 1, and so on.

http_build_queryGenerate
URL-encoded query string PHP 5+可用,

If
You use php <5 You can use this. (It works fine with complex arrays.)  (by
Marco K. (Germany)) WP在用这
<?php 
if (!function_exists('http_build_query'))


    function http_build_query($data, $prefix='', $sep='', $key='')


        $ret = array(); 

        foreach ((array)$data as $k => $v)


            if (is_int($k)
&& $prefix != null)


                $k = urlencode($prefix . $k); 

            } 

            if ((!empty($key)) || ($key === 0))  $k = $key.'['.urlencode($k).']'; 

            if (is_array($v)
|| is_object($v))


                array_push($ret, http_build_query($v, '', $sep, $k)); 

            } else { 

                array_push($ret, $k.'='.urlencode($v)); 

            } 

        } 

        if (empty($sep)) $sep = ini_get('arg_separator.output'); 

        return implode($sep, $ret); 

    }// http_build_query 
}//if 
?>

<
d6eb
/span>

date_add — Alias
of DateTime::add()

DateTime::add -- date_add — Adds
an amount of days, months, years, hours, minutes and seconds to a DateTime object

call_user_func — Call
a user function given by the first parameter 方法名不确定时用此方法来调用

mixed call_user_func ( callback $function [, mixed $parameter [, mixed $... ]]
)

endSet
the internal pointer of an array to its last element

<?php
$fruits = array('apple', 'banana', 'cranberry');
echo end($fruits); // cranberry
?>

join()
join() 函数是 implode() 函数的别名。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息