Coder Social home page Coder Social logo

How to set response header about yaf HOT 9 CLOSED

laruence avatar laruence commented on May 3, 2024
How to set response header

from yaf.

Comments (9)

laruence avatar laruence commented on May 3, 2024

直接用PHP的header吧, 这个方法会弃用。

from yaf.

dwroy avatar dwroy commented on May 3, 2024

还有个小问题呀,
Yaf_Dispatcher::autoRender 能改成可以在conf里配置吗,这个用法找了我半天,一直以为可以配置的

from yaf.

laruence avatar laruence commented on May 3, 2024

不行。 这个没有对应的配置项。

from yaf.

dwroy avatar dwroy commented on May 3, 2024

我的意思是,能不能在你们的下个版本里加这个功能,这样会很方便的^_^

from yaf.

laruence avatar laruence commented on May 3, 2024

恩. 可以, 下个版本加上. 呵呵

from yaf.

jensk avatar jensk commented on May 3, 2024

Would love to see the solution as well.

from yaf.

mykajs avatar mykajs commented on May 3, 2024

I've done this by doing the following which is in an abstract class which my JSON controllers extend.

public function init() {
parent::init();
Yaf_Dispatcher::getInstance()->autoRender(FALSE)->disableView();
header('Content-type: application/json');
}

Works a charm!

from yaf.

elad-yosifon avatar elad-yosifon commented on May 3, 2024

+1

laruence.. can you please implement the setHeader, setAllHeaders,getHeader and clearHeaders methods?

much thx

from yaf.

laruence avatar laruence commented on May 3, 2024

already implemented

from yaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.