Problems getting the address of an HTML file
1. An HTML file to send data through the table one-way php file, how to know the file name of the HTML file in the PHP file (is the filename, for example, hello.html)
2.php file output data (Ajax included in HTML file) to an HTML file through Ajax, how to learn the file name of the HTML file in PHP files
Suddenly think of these two questions, ask you the great God, this is the problem of the solution does not
------Solution--------------------
1,
①referer
② when generating HTML forms, hide a single input
③ setting a cookie record URL when accessing an HTML page
④ use session record URL when accessing HTML page
2,
What does a php file do with Ajax?
------Solution--------------------
1. If you pass the name of the file, then of course you know, otherwise you will not know.
2. If 1
------Solution--------------------
Two problems can be merged. The browser appears to be accompanied by a referer in the head header while the form is being submitted. So that you can pass
$_server[' Http_referer ' to get the file name of the originating request.
For example
PHP Code
if (Isset ($_server[' http_referer ')) { $urlinfo = Parse_url ($_server[' http_referer ']); $filename = basename ($urlinfo [' path ');} I'm not sure if that's what all browsers do.
------Solution--------------------