下面我就列一些Thinkphp自带的函数
get_client_ip()获取IP
url($action,$module,$route,$app,$params)URL组装 支持不同模式和路由
redirect($url,$time=0,$msg=”) URL重定向
说起redirect函数,那次正想使用这样的函数,最后用了header,郁闷
dump() 这个就不说了,这个经常使用,想忘都忘不了
auto_charset($fContents,$from=”,$to=”) 转换字符集,上次我也找了个这样功能的函数用于发送短信。
msubstr($str, $start=0, $length, $charset=”utf-8″, $suffix=true) 字符截取
rand_string($len=6,$type=”,$addChars=”) 产生随机字串,可用来自动生成密码 默认长度6位 字母和数字混合
build_verify($length=4,$mode=1) 获取登录验证码 默认为4位数字
xml_encode($data,$encoding=’utf-8′,$root=”think”) xml编码 这个不错
data_to_xml($data) xml解码
clearCache($type=0,$path=NULL) 清除缓存,这个也非常不错
thinkPHP不为人知的函数
最新推荐文章于 2024-07-17 17:43:29 发布