7
12
2016
3

PHP中过滤富文本编辑器的标签

在最近的工作中在用ThinkPHP做的后台,管理数据,前台的微信端读取数据。

后台的富文本编辑器是KindEditor,它经常会增加一些标签,特别是字体的标签,这样微信端的样式就会无法控制,很麻烦。

感谢Google,我找到了http://htmlpurifier.org/,不过官网是2015年更新的了,应该不支持PHP7

下载,解压,在Vendor目录下建立HTMLPurifier目录,然后把解压文件的Library文件全部拷进去

在ThinkPHP的控制器方法即可使用

vendor('HTMLPurifier.HTMLPurifier#auto');
$config = \HTMLPurifier_Config::createDefault();
$purifier = new \HTMLPurifier($config);
$config->set('HTML.Allowed','p,br,img[src]');
//保留p br img.src标签
$clean_html = $purifier->purify(I('post.postdata'));
Category: php | Tags: php thinkphp
6
16
2016
3

extensions for laravel i used in developing

1,artisan view

composer require sven/artisan-view

regisiter in config/app.php

then use php artisan make:view admin.user.index to generate views

2,laravel ide helper generator

composer require barryvdh/laravel-ide-helper

regisiter in config/app.php

then use php artisan ide-helper:generate

be sure to use it in first to connect database,in other words the web server

3,laravel debugbar

composer require barryvdh/larave-debugbar

regisiter in config/app.php

except serverprovider,the facades

Debugbar => Barryvdh\Debugbar\Facade::class,

Category: php | Tags: larave php

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com