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条)

报告相同问题?

悬赏问题

  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊