Revoke & quot; remove & quot; http: & quot; $ imgurl2substr ($ imgurl, 6); $ imgurl3strstr ($ im script ec (2); script
// How to extract the relative address from the remote image url and create a folder
$ Imgurl = "http://www.111cn.net/images/l/201011/sjfzgm1289209745159.jpg ";
// Remove "http :/"
$ Imgurl2 = substr ($ imgurl, 6 );
$ Imgurl3 = strstr ($ imgurl2, '/'); // This becomes: $ imgurl3 = "/images/l/201011/sjfzgm1289209745159.jpg ";
// Flip the string
$ Imgurl4 = strrev ($ imgurl3); // This becomes: $ imgurl4 = "/gpj.9515479029821mgzfjs/110102/l/segami /";
// Remove "/"
$ Imgurl4 = substr ($ imgurl3, 1); // This becomes: $ imgurl4 = "gpj.9515479029821mgzfjs/110102/l/segami /";
// Remove the file name
$ Imgurl5 = strstr ($ imgurl4, '/'); // This becomes: $ imgurl4 = "/110102/l/segami /";
// Flip and restore
$ Imgurl6 = strrev ($ imgurl5); // This becomes: $ imgurl6 = "/images/l/201011 /";
/*
This is usually the case.
There are also URLs ("")
Then obtain the relative address, first determine the domain name to find
../
./
/
The three types are directory representations.
There are just a few image extensions.
It should be written for use.
*/
// Use regular expressions to extract the content in tags
$ Str ='
Text
Text 2
';
$ Preg = '/<. +?> (. + ?) /Is ';
Preg_match_all ($ preg, $ str, $ result );
Print_r ($ result [1]);