私はZF2を学ぼうとしています。Ajaxを使用してデータを取得するページがあります。ZF2関数はJSON文字列を返す必要があります。
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\View\Model\JsonModel;
class DocumentsController extends AbstractActionController {
public function indexAction() {
}
public function getTreeDataAction() {
$json = new JsonModel(array(
'title' => 'Some Title'
));
return $json;
}
}
しかし、私はこの致命的なエラーを受け取り続けます:
( ! ) Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "application/documents/get-tree-data"; resolver could not resolve to a file' in ../vendor/ZF2/library/Zend/View/Renderer/PhpRenderer.php on line 451
私はこのエラーとZF2でajax呼び出しを行うための最良の方法を探していましたが、ZF1またはZF2ベータの結果が表示され続けて機能しません。アドバイスありがとうございます。