<?php
$str = <<<str
    <img src="1.jpg"/>
    <p>123123</p>
    <span>3322</span>
    <img src="https://www.baidu.com/2.png" alt="">
    <img src="https://www.baidu.com/2.jpeg" alt="">
    <img src="https://www.baidu.com/2.bmp" alt="">
    <img src="https://www.baidu.com/2.bmp" alt="">
    <img src='https://www.baidu.com/2.bmp' alt="">
str;

preg_match_all( '~<img.*?src=["\']+(.*?)["\']+~' , $str, $match );

p($match['1']);

/**Array
(
    [0] => 1.jpg
    [1] => https://www.baidu.com/2.png
    [2] => https://www.baidu.com/2.jpeg
    [3] => https://www.baidu.com/2.bmp
    [4] => https://www.baidu.com/2.bmp
    [5] => https://www.baidu.com/2.bmp
)
**/

function p($var)
{
    if (is_bool($var)) {
        var_dump($var);
    } else if (is_null($var)) {
        var_dump(NULL);
    } else {
        echo "<pre style='position:relative;z-index:1000;padding:10px;border-radius:5px;background:#F5F5F5;border:1px solid #aaa;font-size:14px;line-height:18px;opacity:0.9;'>" . print_r($var, true) . "</pre>";
    }
}

nginx 解析php conf配置文件

本博客的nginx 配置文件 server { listen 80;#80和443端口同时监听 listen 443 ssl; server_name www.koukousky.com koukousky.com...

阅读全文

php composer 安装阿里云镜像

#doc: https://developer.aliyun.com/composer 全局配置(推荐) composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ 取消配...

阅读全文

intervention/image处理IOS上传图片翻转问题

#安装 $ composer require intervention/image <?php use Intervention\Image\ImageManagerStatic as Image; //test.png要处理的图片路径 Image::make(&...

阅读全文

欢迎留言