123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- function p($arr)
- {
- echo '<pre>';
- print_r($arr);
- echo '<pre>';
- }
- /*function dump($var, $echo=true, $label=null, $strict=true) {
- $label = ($label === null) ? '' : rtrim($label) . ' ';
- if (!$strict) {
- if (ini_get('html_errors')) {
- $output = print_r($var, true);
- $output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
- } else {
- $output = $label . print_r($var, true);
- }
- } else {
- ob_start();
- var_dump($var);
- $output = ob_get_clean();
- if (!extension_loaded('xdebug')) {
- $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
- $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';
- }
- }
- if ($echo) {
- echo($output);
- return null;
- }else
- return $output;
- }*/
- //if(!function_exists('f_unit'))
- //{
- // function f_unit($str,$unit = null){
- //
- // if(empty($str)) return '暂无资料';
- // if($unit != null)
- // {
- // $arr = ['平方米','个','栋','户','年'];
- // foreach ($arr as $val)
- // {
- // if($val == $unit)
- // {
- // if(strpos($str,$val) !== false)
- // {
- // return $str;
- // }
- // else
- // {
- // return $str.$val;
- // }
- // }
- //
- // }
- // }
- // return $str;
- // }
- //}
- if(!function_exists('is_mobile'))
- {
- function is_mobile()
- {
- if(isset($_SERVER['HTTP_USER_AGENT']))
- {
- $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
- $is_pc = (strpos($agent, 'windows nt')) ? true : false;
- $is_mac = (strpos($agent, 'mac os')) ? true : false;
- $is_iphone = (strpos($agent, 'iphone')) ? true : false;
- $is_android = (strpos($agent, 'android')) ? true : false;
- $is_ipad = (strpos($agent, 'ipad')) ? true : false;
- // if($is_pc){
- // return false;
- // }
- //
- // if($is_mac){
- // return true;
- // }
- if($is_iphone){
- return true;
- }
- if($is_android){
- return true;
- }
- if($is_ipad){
- return true;
- }
- }
- }
- }
|