dougao7801 2016-10-25 21:36
浏览 63
已采纳

使用xdebug和前端js SPA?

I have xdebug working great when I access my server directly (thru a vhost entry to the IP set up by homestead/vagrant). However, I have a decoupled frontend that I'm running on localhost:8080, that talks to that laravel backend server, but xdebug doesn't trigger on those requests. I think I just have to set the cookie XDEBUG_SESSION=PHPSTORM in my requests coming from the front-end, however I'm not sure how to do that with vue-resource as I didn't see anything in the docs for this. I tried the following:

Vue.http.headers.common['Cookie'] = 'XDEBUG_SESSION=PHPSTORM'

however, I get warned Refused to set unsafe header "Cookie" by chrome. Anyone have ideas of anything else I can try?

  • 写回答

1条回答 默认 最新

  • doucanshou6998 2016-10-25 22:03
    关注

    Couple of possible approaches outside of using COOKIE or GET/POST parameter.

    1. Use xdebug.remote_autostart = 1 in your php.ini -- will attempt to debug every single request (regardless of cookies or GET/POST parameters).

      Do not forget to restart you web server / PHP so that it will read you new config file.

      Downside: will attempt to debug every single request .. so even if no debugging is required you may see approx 1 sec delay while xdebug is trying to establish debug connection.

    2. Place xdebug_break(); in actual PHP code -- programmatic breakpoint that will also initiate debug session.

      Downside: need to edit PHP code for that.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Linux环境下CA证书更新问题
  • ¥15 sqlserver语句提取结果以外数据
  • ¥60 微信小程序如何上传QQ聊天文件
  • ¥300 开发的系统遭到无良商家的破解,请问如何防止再次发生,并追回损失
  • ¥15 java代码写在记事本上后在cmd上运行时无报错但又没生成文件
  • ¥15 关于#python#的问题:在跑ldsc数据整理的时候一直抱这种错误,要么--out识别不了参数,要么--merge-alleles识别不了参数(操作系统-linux)
  • ¥15 PPOCRLabel
  • ¥15 混合键合键合机对准标识
  • ¥100 现在不懂的是如何将当前的相机中的照片,作为纹理贴图,映射到扫描出的模型上
  • ¥15 安卓OpenCV人脸识别分类器加载