mr4-lc / content-protected
Laravel内容保护
0.0.1
2023-11-24 06:58 UTC
Requires
- php: >=7.0.0
Requires (Dev)
- phpunit/phpunit: >=6.0
README
这是一个集成[内容保护]的laravel
组件。保护网页内容。
开放模式
- 开发者(和爬虫)可以访问影子根。
关闭模式
- 开发者(和爬虫)可以访问影子根。
截图
安装
composer require mr4-lc/content-protected php artisan vendor:publish --tag=mr4-lc-content-protected --force
配置
使用
示例路由器
$router->get('content-protected', 'HomeController@getContentProtected')->name('content-protected.get');
示例控制器
public function getContentProtected() { $id = request()->get('id'); return response("<span>This is protected content <u>$id</u></span>", 200); }
示例用法
<form action="{{ route('content-protected.get') }}" method="GET" onsubmit="return false;"> <x-mr4-lc.content-protected id="1" /> <x-mr4-lc.content-protected id="2" mode="open"/> <x-mr4-lc.content-protected id="3" className="customize" adoptedStyleSheets="span { color: red; border: 2px dotted black;}" /> </form>
基本用法
<x-mr4-lc.content-protected id="1" />
=>
<div class="mr4-lc-content-protected 1 " data-content-id="1" data-mode="closed"> #shadow-root (closed) <span>This is protected content <u>1</u></span> </div>
开放模式
<x-mr4-lc.content-protected id="2" mode="open"/>
=>
<div class="mr4-lc-content-protected 2 " data-content-id="2" data-mode="open"> #shadow-root (open) <span>This is protected content <u>2</u></span> </div>
自定义CSS
<x-mr4-lc.content-protected id="3" className="customize" />
=>
<div class="mr4-lc-content-protected 2 customize" data-content-id="3" data-mode="closed"> #shadow-root (closed) <span>This is protected content <u>3</u></span> </div>
许可证
在The MIT许可证(MIT)下授权。