本文整理汇总了PHP中Index::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::config方法的具体用法?PHP Index::config怎么用?PHP Index::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index::config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function __construct()
{
if (!$this->checkIsUser()) {
Routes::redirect();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$params = array();
$params['secret'] = '6Lf3ZxMTAAAAANVc5p92ISpeXZp8oTTrOr5WS6iD';
// Secret key
if (!empty($_POST) && isset($_POST['g-recaptcha-response'])) {
$params['response'] = urlencode($_POST['g-recaptcha-response']);
}
$params['remoteip'] = $_SERVER['REMOTE_ADDR'];
$params_string = http_build_query($params);
$requestURL = 'https://www.google.com/recaptcha/api/siteverify?' . $params_string;
$curl = curl_init();
curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $requestURL));
$response = curl_exec($curl);
curl_close($curl);
$response = @json_decode($response, true);
if ($response["success"] != true && !$this->checkIsUser()) {
echo '<h3 class="alert alert-danger">Captcha - bład w weryfikacji</h3>';
} elseif ($response["success"] || self::$isLogged) {
if ($this->addPost($_POST)) {
header('Location: ' . parent::config()['url']);
}
}
} else {
$this->setPostModel();
}
}
示例2: deleteContact
private function deleteContact($recordId)
{
if (is_int((int) $recordId)) {
$db = Index::DB();
$query = $db->prepare("DELETE FROM address_book WHERE id = ?");
$result = $query->execute([$recordId]);
if ($result) {
header("Location: " . Index::config()['url'] . 'address-book');
} else {
self::$data['error'] = 'Błąd przy usuwaniu kontaktu.';
}
}
}
示例3: redirect
public static function redirect()
{
header('Location: ' . Index::config()['url']);
}