我相信我遇到这个问题的原因是因为.htaccess
(尽管它们在离线和在线中是一样的)。
http://localhost/myProject/api/webservice/getUsers -> Works
http://myProjectDomain.com/api/webservice/getUsers -> Doesn't work, error: 500 Internal Error
.ht 从根文件夹访问:
Options -Indexes
Options +FollowSymLinks
# Set the default file for indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
# activate URL rewriting
RewriteEngine on
# do not rewrite links to the documentation, assets and public files
RewriteCond $1 !^(index'.php|public|images|robots'.txt)
# do not rewrite for php files in the document root, robots.txt or the maintenance page
RewriteCond $1 !^([^'..]+'.php|robots'.txt)
# but rewrite everything else
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
在我看来,我可能需要创建另一个规则?像这样:
RewriteRule ^(.*)$ index.php?/api/webservice/$1 [L]
已解决。
我在本主题中找到了答案:脚本中的格式错误的标头。错误的标头= 1:索引.php
几周前,我不得不更改我的REST_controller.php
文件,以便从Web服务接收大量数据。虽然我发现了一个小错误,但当数据量太大时,它不会完全检索它。
例如,格式为 JSON。
[{data: {'values': '1'}, {'values': '2'}]
现在这是大规模的只检索我:
[{data: {'values': '1'}, {'values': '2'
是的,它错过了}]
,因此 JSON 格式不好。所以我对代码进行了一些更改,从:
header('Content-Length: ' . strlen($output));
自:
header('Content-Length: ' . strlen($output) + 15);
但是我犯了一个基本的错误,如果我用键入的语言编码,我就不会这样做。这些值实际上不是相加的,而是串联的。溶液:
header('Content-Length: ' . (strlen($output) + 15));