douwudie8060 2013-08-24 23:00
浏览 89
已采纳

Yii,如何在不结束PHP脚本执行的情况下结束Yii应用程序执行

I'm currently writing an app as a plugin to wordpress and hence I need some unconventional solutions..

Currently my problem is that when Yii gets an error it throws the error at its error handler and then it exits PHP execution. Shouldn't there be a way to sandbox Yii to make it only quit it's own execution and let the external code continue?

In my case most of the page goes blank and none of the wordpress theme gets loaded.. So it becomes pretty hacky to design good error pages. (When everything goes ok, wordpress loads in Yii in the_content(); and it blends in with the wordpress theme.)

Any ideas?

  • 写回答

3条回答 默认 最新

  • doulang6013 2013-08-25 23:30
    关注

    You'll probably want to end up overriding the default Yii error / exception handlers to put in custom ones. If you take a look at my article about integrating Yii/Wordpress, there is an example of an expection handler override. Adapt that to your use and you should be fine.

    Adjusting the site/error handler is not going to end up working well for you, as that tends to throw a 400 error header that you can't stop even if you render a different page. Ran into that the hard way while integrating Yii and Wordpress, as I tried that first.

    Let us know if you get it going, would love to have better example code for melding Yii on as a plugin.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!