douren7179 2014-09-15 13:59
浏览 34

Symfony 2.5服务器返回500状态

When I'm doing a request into API that I've written using Symfony 2.5. I'm sending form data using POST method and in the controller I'm doing

$params = json_decode($request->getContent(), true);

and if I do

var_dump($params);

I can see everything in console If I'm doing

console.log(data)

But If I try just do something like this:

array_keys($params)

Server returns me a 500 status code and error:

XMLHttpRequest cannot load http://host.loc/app_dev.php/posts. Invalid HTTP status code 500 
  • 写回答

1条回答 默认 最新

  • duangaixing1509 2014-09-15 14:13
    关注

    You will always get 500 Error if something went completely wrong.

    e.g. even use dump() in twig - which is not allowed in production

    1) try the same page in /app_dev.php/[page] - enable debug, this should give you alot of info about the error

    2) look at the correct log file /app/logs/ as mentioned above

    I guess you calling getContent() on a null Object ;-)

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度