我想要一个共享文件夹,其中包含子文件夹内的html页面访问的图像。(子文件夹)
If you mean your html folder and images folder are siblings, you're probably looking for the ..
directory... um, thingy.
Your files look like:
/www
/html
index.php
/images
myimage.png
Write an img tag like this:
<img src="../images/myimage.png" />
在您的网站中创建一个文件夹并将图像放入其中。
Basically, there are two ways of linking to a resource (page/script/image/whatever):
http://www.yourserver.com/path/to/resource.jpg
http://www.yourserver.com/path/from/page.html
to http://www.yourserver.com/path/to/resource.jpg
, you use ../to/resource.jpg
So just put your images on a publicly accessibly folder, and refer to them using one of those two methods.
Or refine your question :)
If I got it right, you have a folder with many folders inside, and inside does many folder you have html pages, and you want does pages to access the first folder...
main_folder
pic.png
pic.gif
pic.jpg
sub_folder
html_page.php
just use ../pic.png when you call the image file from the html_page.php
Was this what you where looking for ?
You can get the directory of the current file with the dirname funciton:
dirname(__FILE__)
If you want the parent directory you can use '..' thus:
$current_dir = dirname(__FILE__);
$parent_dir = $current_dir.'/..';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.