以下是 软件包 readme 的基本用法示例:
use fuko\masked\protect;//隐藏$secret_key var中的值protect::hidevalue($secret_key);//隐藏$ _post['password'] 的值protect::hideinput('password', input_post);$redacted = protect::protect($_post);
根据上述调用,列入黑名单的值和输入将被屏蔽。自述文件的另一个例子是调试黑名单,类似于 laravel 5 的 whoops 黑名单:
use \fuko\masked\protect;protect::hideinputs(array( input_env => array( 'app_key', 'db_password', 'redis_password', 'mail_password', 'pusher_app_key', 'pusher_app_secret', ), input_server => array( 'php_auth_pw', 'app_key', 'db_password', 'redis_password', 'mail_password', 'pusher_app_key', 'pusher_app_secret', ), input_post => array( 'password', ) ));//传递信息 `\fuko\masked\protect::protect()`//将隐藏列入黑名单的输入\fuko\masked\protect::protect($_post);
查看自述文件以获取更多示例,包括自定义屏蔽规则。您可以在 fuko-php/masked 上了解有关此软件包的更多信息,获取完整的安装说明以及在 github 上查看源代码。
更多php知识,请访问!
以上就是使用 php masked package 屏蔽敏感数据的详细内容。
