Add a variable before the image download address-php Tutorial

Source: Internet
Author: User
Fixed images with variables in front of images include 0001.jpg 0002.jpg
The variables are AA and BB.

To implement and be able to open/AA-0001.jpg/AA-0002.jpg
/BB-0001.jpg/BB-0002.jpg


Reply to discussion (solution)

PHP Cainiao thank you for your help

 $ar=array('0001.jpg' ,'0002.jpg'); $a='AA'; $b='BB'; foreach($ar as $v){      echo '/'.$a.'-'.$v .'
'; echo '/'.$b.'-'.$v .'
'; }



Show/AA-0001.jpg/AA-0002.jpg when variable = AA

Show/BB-0001.jpg when variable = BB

Display/CC-0002.jpg when variable = CC



/0001.jpg can open an image
/AA-0001.jpg this picture cannot be opened

If you don't understand what you mean, you can open it and check whether the image exists.

Quote: reference the reply from jordan102 on the second floor:

/0001.jpg can open an image
/AA-0001.jpg this picture cannot be opened

Do you want to download an image without changing the file name?
Maybe you can try rewrite.

/0001.jpg can open an image
/AA-0001.jpg this picture cannot be opened

Do you want to download an image without changing the file name?
Maybe you can try rewrite.

This means that the file name will not change according to the user's download ID + image file name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.