我想json在控制器中以格式显示响应,并且不希望在视图中移动.所以,请让我以任何方式让我能够表达json回应.
这是我想添加json标题的代码.
$result = $this->mod_doc->get_list();
echo json_encode($result);
Run Code Online (Sandbox Code Playgroud) 我试过以下代码.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我在配置文件index_page中替换为空白,但仍然无法正常工作并出现此错误.
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.