php常用函数详解

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wm9028/article/details/86606085

array_key_exists

(PHP 4 >= 4.0.7, PHP 5, PHP 7)
array_key_exists — 检查数组里是否有指定的键名或索引

<?php
$foo = array();
$foo['bar'] = NULL;

var_dump(isset($foo['bar']));
var_dump(array_key_exists('bar', $foo));
?>

will output:
bool(false)
bool(true)

Be aware of this!

json 是Unicode编码

php5.4以上。使用函数json_encode($data,JSON_UNESCAPED_UNICODE)

// 返回JSON数据格式到客户端 包含状态信息
header('Content-Type:application/json; charset=utf-8');
exit(json_encode($data,JSON_UNESCAPED_UNICODE));

猜你喜欢

转载自blog.csdn.net/wm9028/article/details/86606085