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

$_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($rethttp_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 
?>


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() 函数的别名。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值