为什么json_encode()之后,数组里元素成空值?
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
$data = array("order_table" => $order_table,"html"=>$html);
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
eval("(" + xmlHttp.responseText + ")");
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> $data = json_decode($data); print_r($data );
public function removeMenuItemAction(){
$request = $this->getRequest();
$layout = $this->_helper->layout();
$layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$menuId = $request->getParam('menuId', null);
if( $menuId > 0 ){
$SQLTool = new MysqlTool();
$con = $SQLTool->getConnect();
if( $con ){
$sqlLineMenu = "select Id FROM menubar where Type=0";
$resultMenu = mysql_query($sqlLineMenu);
$rowMenubar = mysql_fetch_array($resultMenu,MYSQL_ASSOC);
$menubarId = $rowMenubar['Id'];
// remove his children
$this->callBackMenuitemDelete($menuId,$menubarId);
$sqlLine = "DELETE FROM menuitem WHERE Id = " . $menuId;
mysql_query($sqlLine);
mysql_close($con);
echo json_encode(array('message'=>"删除成功"));
}
}else{
echo json_encode(array('message'=>"删除失败"));
}
}
<br><font color="#e78608">------解决方案--------------------</font><br>这个不是多维数组的问题吧<br><br>感觉是含有 GB2312 的中文的原因<br><br>用UTF8<br><br>试试把HTML全部用英文或者UTF8格式,看看输出什么<br><br>
$data = array("order_table" => $order_table,"html" => iconv("GBK","UTF-8//IGNORE",$html));
<br><font color="#e78608">------解决方案--------------------</font><br>
$data = array("order_table" => $order_table,"html"=>$html);
exit(json_encode($data));
<br><font color="#e78608">------解决方案--------------------</font><br>这种情况,只能是你手误了... $html 真的有东西? <div class="clear"></div>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号