HTML form action using a php file outside of root directory?

后端 未结 4 1750
孤城傲影
孤城傲影 2021-01-13 18:47

I am wondering, there are a few files I have kept outside of the root directory in a different directory and I am trying to use a HTML form to post info to a php file that s

4条回答
  •  一整个雨季
    2021-01-13 19:22

    Make a proxy script... something which is inside the web directory, but all it does is include the appropriate "protected" file:

    DOCROOT/form_handler.php

    DOCROOT/form.html

    ...
    
    ...

    This is, in fact, how many sites are setup (in essence at least). It is typical to place most of your scripts outside the DOCROOT like this for in the rare case where Apache or similar does not parse your PHP (i.e. if it is misconfigured), it doesn't inadvertently send your source code.

提交回复
热议问题