js获取当前网页地址

<button onclick="setFocus()">使编辑器获得焦点</button>
        <button onmousedown="isFocus(event)">编辑器是否获得焦点</button>
        <button onmousedown="setblur(event)" >编辑器失去焦点</button>


json与对象、数组之间的转换

$json = '{"name":"json","age":11}';
$array = array('name'=>'array','age'=>22);
$object = new StdClass;
$object->name = 'object';
$object->age = '33';

echo "json转object<br />";
$var1 = json_decode($json);// json转object
var_dump($var1);

echo "<hr />";
echo "json转array<br />";
$var2 = json_decode($json,true);// json转array
var_dump($var2);

echo "<hr />";
echo "array转json<br />";
$var3 = json_encode($array);// array转json
var_dump($var3);

echo "<hr />";
echo "object转json<br />";
$var4 = json_encode($object);// object转json
var_dump($var4);