1. Go to this page and download the library: Download hainuo/think-rbac library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hainuo / think-rbac example snippets
namespace app\admin\controller;
class Auth extends AdminBase
{
public function _empty($name)
{
$auth = new \think\auth\Auth();
$auth = $auth->autoload($name);
if ($auth) {
if (isset($auth['code'])) {
return json($auth);
} elseif (isset($auth['file'])) {
return $auth['file'];
}
$this->view->engine->layout(false);
return $this->fetch($auth[0], $auth[1]);
}
return abort(404, '页面不存在');
}
}