Does PHP Have an Equivalent of Java's RequestDispatcher.forward?

后端 未结 7 2134
南笙
南笙 2021-02-06 03:32

In Java I can write a really basic JSP index.jsp like so:

<% request.getRequestDispatcher(\"/home.action\").forward(request, response); %>

7条回答
  •  后悔当初
    2021-02-06 04:14

    You can use like:

    header ("Location: /path/");
    exit;
    

    The exit is need just in case some HTML output was sent before, the header() will not work, so you must sent new header before any output to the browser.

提交回复
热议问题