javascript - How to load a file from a different src folder in php -
.php page, I think I'm missing something, but I'm going to have other folders on the same server and domain Should be able to pull I tried to put a full path in " However, if it is not in the same folder then it appears only empty. & gt; DOCTYPE html public "- // W3C // DTD XHTML 1.0 Transcription / N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Title & gt; Untitled document & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; textarea cols = "30" rows = "10" & gt; & Lt ;? Php $ filename = "../projectevo/new-page-6.html"; $ handle = fopen ($ filename, "r"); $ Content = fred ($ handle, files ($ filename)); fclose ($ handle); $ Content echo; ? & Gt; & Lt; / Text field & gt; & Lt; / Body & gt; & Lt; / Html & gt;
You must enter the full path in the file if it is in other directories
// Get the base path on your website $ basePath = dirname (__ FILE__); // Now use the full path for file $ filename = $ basePath "/path/to/file/new-page-6.html" if the files are in a directory but In Eltar subfolders, specify one level above, for example:
-main_directory --dirA --- current page php --dirb --- new page-6.html Assume that the current-page.php is currently full, you can access the file using relative paths :
$ filename = "../dirB/new-page-6.html" Just make sure you add the full path to your file Are there.
More paths:
-
-
Comments
Post a Comment