随笔分类 -  PHP

PHP相关知识,代码片段
摘要:/** * 验证身份证基本格式 * @param $idcard * @return bool */ public static function validateIdcard($idcard) { $City = array( '11', '12', '13', '14', '15', '21', 阅读全文
posted @ 2017-10-12 09:51 木辰于 阅读(737) 评论(0) 推荐(0)
摘要:http://idea.lanyus.com/ 阅读全文
posted @ 2017-10-12 09:50 木辰于 阅读(226) 评论(0) 推荐(0)
摘要:匹配字符串 {% if '皮肤' in '皮肤23213' %}1{% else %}2{% endif %} 时间格式转换 {{ time|date('Y-m-d H:i:s') }} 提取需要长度的字符串 {{ app.session.get(‘city_name’)[0:2] }}(如北京市提 阅读全文
posted @ 2017-10-12 09:46 木辰于 阅读(269) 评论(0) 推荐(0)
摘要:// $text=file_get_contents('http://huaban.com/'); // preg_match_all('/<img[^>]*>/i', $text, $match); // print_r($text); $keyword = "火影"; $keyword = ur 阅读全文
posted @ 2017-05-02 10:48 木辰于 阅读(679) 评论(0) 推荐(0)
摘要:数组中文加数字 以数字排序 $a['4']='123区'; $a['5']='3区'; $a['6']='32区'; $a['7']='8区'; foreach ($a as $k => $v) { preg_match('/\d+/',$v,$arr); if(!empty($arr)){ $na 阅读全文
posted @ 2017-05-02 10:44 木辰于 阅读(365) 评论(0) 推荐(0)
摘要:function ismobile() { // 如果有HTTP_X_WAP_PROFILE则一定是移动设备 if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) return true; //此条摘自TPM智能切换模板引擎,适合TPM开发 if(isset ($_ 阅读全文
posted @ 2017-05-02 10:41 木辰于 阅读(174) 评论(0) 推荐(0)