Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Joomla Json UTF8_Php_Joomla - Fatal编程技术网

Php Joomla Json UTF8

Php Joomla Json UTF8,php,joomla,Php,Joomla,my view.html.php class LigaportalViewJsonarticles extends JViewLegacy { /** * Display the view */ public function display($tpl = null) { // Get the document object. $document = JFactory::getDocument(); $document-&g

my view.html.php

class LigaportalViewJsonarticles extends JViewLegacy
{
    /**
     * Display the view
     */
     public function display($tpl = null)
    {
    // Get the document object.
    $document = JFactory::getDocument(); 
    $document->setMimeEncoding('application/json');
    JRequest::setVar('tmpl', 'component');   
    $ligaId = JRequest::getVar("competitionID",null,"get","String");
    $limit = JRequest::getVar("limit",null,"get","String");
    $model = $this->getModel();
    $data = $model->getContent($ligaId, $limit*5);
   //  parent::display($tpl);  
    //Deaktivierung der gesamten Layout-Komponente, 
    //die für html, head, meta und body-Tags zuständig ist
 //echo  utf8_encode($data);
    parent::display($tpl);


    echo new JResponseJson( $data);
    jexit();;
}//function 
}
现在我的问题是输出,其中有\u00d6。$data是一个简单的joomla select

我的输出是:

{"success":true,"message":null,"messages":null,"data":    [{"ligaid":"33","title":"Transfernews in der O\u00d6-Liga - nun auch Champions League-Glanz in Bad Ischl","publish_up":"2014-01-30 18:50:20"},{"ligaid":"33","title":"SV Gmundner Milch holt 4 Talente","publish_up":"2014-01-30 12:56:02"},{"ligaid":"33","title":"SC Marchtrenk zieht zweite Verst\u00e4rkung an Land","publish_up":"2014-01-28 09:53:51"},{"ligaid":"33","title":"O\u00d6-Ligisten im Testspieleinsatz","publish_up":"2014-01-26 18:21:38"},{"ligaid":"33","title":"UFC Eferding: Keine Transfers, aber intensive Vorbereitung","publish_up":"2014-01-26 09:01:27"}]}

thx

问题主要在于
JResponseJson
使用的是
json\u encode()
。当您不向其传递任何额外参数时,
json\u encode()
将自动具有此行为

要使其正常工作,您需要PHP5.4+,并将选项
json\u UNESCAPED\u UNICODE
传递到
json\u encode()。另请参见带有

要回到您的问题,请将有问题的行替换为:

 echo json_encode($data, JSON_UNESCAPED_UNICODE);

希望这有帮助。

为什么会有问题?