Home >Backend Development >PHP Tutorial >Add domain name to pictures in editor_PHP tutorial
/**
* Replace the image in fckedit and add a domain name
* @param string $content The content to be replaced
* @param string $strUrl The domain name to be added to the image in the content
* @return string
* @eg
*/
function replacePicUrl($content = null, $strUrl = null) {
if ($strUrl) {
Extract the src regular expression of the image path formula and store the results in $matches matches);
$img = "";
if(!emptyempty($matches)) {
//Note that the above regular expression indicates that the value of src is placed in the third position of the array
$img = $matches[2];
}else {
$img = "";
} }
if (!emptyempty($img)) { array();
$replacements = array();
foreach($img as $imgItem){
$final_imgUrl = $strUrl.$imgIt em; 🎜> $img_new = "/".preg_replace("///i","/",$imgItem)."/"; > //Replacement content
$vote_content = preg_replace($patterns, $replacements , $content);
🎜>}
http://www.bkjia.com/PHPjc/478768.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/478768.html
TechArticle
/*** Replace the picture in fckedit and add the domain name * @param string $content The content to be replaced * @param string $strUrl The domain name to be added to the picture in the content * @return string * @eg*/ function r...