hyperf框架QueryList(phpQuery)
生活随笔
收集整理的这篇文章主要介绍了
hyperf框架QueryList(phpQuery)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
安装QueryList,使用Composer安装
执行Composer安装命令:
composer require jaeger/querylist:V3.2.1在项目中使用QueryList (use QL\QueryList)直接引用
<?phpdeclare(strict_types = 1); namespace App\Controller;use Hyperf\View\RenderInterface; use Hyperf\HttpServer\Annotation\AutoController; use QL\QueryList; /*** @AutoController*/ class WelcomeController {public function abc(){$content = '<p><span style="color: rgb(68, 68, 68); background-color: rgb(255,255,255); font-size: 15px;">近日,</span><span style="color: rgb(0, 112, 192); background-color: rgb(255, 255, 255); font-size: 15px;"><strong>《深圳市20大先进制造业园区空间布局规划》</strong></span><span style="color: rgb(68, 68, 68); background-color: rgb(255, 255, 255); font-size: 15px;">出炉,按照集中连片、产住分离的原则,在宝安、龙岗、龙华、坪山、光明、盐田、大鹏新区、深汕特别合作区合理划定先进制造业园区,总规划用地面积约300平方公里,按照启动区、拓展区、储备区有计划释放工业用地面积约60平方公里。</span></p><p><img src="uploads/2022-08/155b40d3e9690cd7ef9895d7ac9f978f.jpg" alt="测试" data-href="111" style=""/></p>';\phpQuery::newDocumentHTML($content);$pq = pq(null);$images = $pq->find("img");if ($images->length) {foreach ($images as $img) {$img = pq($img);$imgSrc = $img->attr("src");$img->attr("src", 'https://mxxxx.com/'.$imgSrc);}}$content = $pq->html();\phpQuery::$documents = null;return json_encode(['c'=>$content]);} }QueryList文档地址QueryList V3 中文文档
总结
以上是生活随笔为你收集整理的hyperf框架QueryList(phpQuery)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 移动端、公众号、小程序pdf转图片,pd
- 下一篇: ThinkPHP6+querylist