简体   繁体   中英

How can I select an image from another folder?

I have two folders in the root folder ( Admin and Users ). Now I'm working on a file in the Users folder, and want to display user's details when they login. The images were saved in the Admin folder, so how do I call the image from the Admin folder for it to be displayed on a page in the Users folder?

This is what I tried, but it didn't work:

<img SRC="/Admin/images/<?php echo $user_pic ; ?>" class="img-rounded" />

I also tried with two dots in front of admin but that didn't work either. Any ideas?

Let's look at the following file tree.

Root
  Users
  Admins

If you are in root, and want to access an image inside the admins folder, path would either be

admin

Or a relative path

/admin

If you are in the admin folder, wanting to acres the users folder, you need to backtrack folders. You can do this by doing ../

../users

This would go to root and then users.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM