本文整理汇总了PHP中core\Config::Reader方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::Reader方法的具体用法?PHP Config::Reader怎么用?PHP Config::Reader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Config
的用法示例。
在下文中一共展示了Config::Reader方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function __construct()
{
$driver = array("mysql" => "mysql:dbname=%s;host=%s", "oracle" => "oci:dbname=%s;host=%s;port=1521", "pgsql" => "pgsql:dbname=%s host=%s");
try {
$this->PDO = new PDO(sprintf($driver[Config::Reader("BD_DRIVE")], Config::Reader("BD_NAME"), Config::Reader("BD_HOST")), Config::Reader("BD_USER"), base64_decode(Config::Reader("BD_PASS")), array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_TIMEOUT => 5, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
} catch (PDOException $e) {
return json_encode(["data" => "Ha Ocurrido un error al conectarse (" . $e->getMessage() . ")"]);
}
}
示例2: procesar
function procesar()
{
$c = "Control\\" . Config::Reader("control");
if (class_exists($c, true)) {
$funcion = Config::Reader("function");
$control = new $c();
$control->Run($funcion, explode("/", Config::Reader("parametros")));
} else {
echo json_encode(["data" => "Recurso no disponible"]);
}
}
示例3: before
function before($funcion)
{
if ($funcion != "authenticate") {
try {
$secretKey = base64_decode(Config::Reader("SALT"));
$header = apache_request_headers();
$header["Authorization"] = trim(str_replace("Bearer", "", $header["Authorization"]));
$jwt = JWT::decode($header["Authorization"], $secretKey, array('HS512'));
$this->UserToken = $jwt;
} catch (ExpiredException $e) {
$this->Response["error"] = $e->getMessage();
return false;
}
}
return true;
}
示例4: authenticate
function authenticate()
{
$usuario = $this->Usuarios->findByUsuario($this->Post["usuario"]);
if (!empty($usuario)) {
if (password_verify($this->Post["password"], $usuario["pass"])) {
unset($usuario["pass"]);
$secretKey = base64_decode(Config::Reader("SALT"));
$data = ['iss' => SITE, 'aud' => SITE, 'iat' => time(), 'exp' => time() + 60 * 60 * 24 * 7, 'sub' => 'usuario', 'admin' => true, 'data' => $usuario];
$jwt = JWT::encode($data, $secretKey, 'HS512');
$this->Response = ['token' => $jwt];
} else {
$this->Response = ["error" => "La contraseña o usuario incorrecto"];
}
} else {
$this->Response = ["error" => "El usuario no existe"];
}
}
示例5: ucwords
function __construct()
{
$this->NameForm = ucwords(substr(Config::Reader('control'), 0, -7)) . ucwords(Config::Reader('function'));
}