脚本宝典收集整理的这篇文章主要介绍了php – 在Symfony 2中发送文本普通标题,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我试着按照Symfony docs : Requests and Responses in Symfony部分.但是,无论我做什么,我的控制器都会发送文本/ htML内容类型.
这是我的行动:
function showAction($action = null,$format = null){ $locale = $this->get('session')->getLocale(); $format = $this->getRequest()->get("format"); $format = isset($format) ? $format : 'html'; if ($format === 'text'){ $response = new Response(); $response->headers->set('Content-tyPE','text/plain'); $response->sendHeaders(); } $view = sPRintf('MyBundle:Email:%s.%s.%s.twig',$action,$locale,$format); return $this->render($view,array()); }
那么如何发送文本普通标题以及我哪里出错?
以上是脚本宝典为你收集整理的php – 在Symfony 2中发送文本普通标题全部内容,希望文章能够帮你解决php – 在Symfony 2中发送文本普通标题所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。