本文整理汇总了PHP中core\Security::getCSRFToken方法的典型用法代码示例。如果您正苦于以下问题:PHP Security::getCSRFToken方法的具体用法?PHP Security::getCSRFToken怎么用?PHP Security::getCSRFToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Security
的用法示例。
在下文中一共展示了Security::getCSRFToken方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: href
/**
* Hyperlink
*
* @access public
* @param string $controller Controller name
* @param string $action Action name
* @param array $params Url parameters
* @param boolean $csrf Add a CSRF token
* @param string $anchor Link Anchor
* @return string
*/
public function href($controller, $action, array $params = array(), $csrf = false, $anchor = '')
{
$values = array('controller' => $controller, 'action' => $action);
if ($csrf) {
$params['csrf_token'] = Security::getCSRFToken();
}
$values += $params;
return '?' . http_build_query($values, '', '&') . (empty($anchor) ? '' : '#' . $anchor);
}
示例2: build
/**
* Build relative url
*
* @access private
* @param string $separator Querystring argument separator
* @param string $controller Controller name
* @param string $action Action name
* @param array $params Url parameters
* @param boolean $csrf Add a CSRF token
* @param string $anchor Link Anchor
* @param boolean $absolute Absolute or relative link
* @return string
*/
private function build($separator, $controller, $action, array $params = array(), $csrf = false, $anchor = '', $absolute = false)
{
$path = $this->router->findUrl($controller, $action, $params);
$qs = array();
if (empty($path)) {
$qs['controller'] = $controller;
$qs['action'] = $action;
$qs += $params;
}
if ($csrf) {
$qs['csrf_token'] = Security::getCSRFToken();
}
if (!empty($qs)) {
$path .= '?' . http_build_query($qs, '', $separator);
}
return ($absolute ? $this->base() : $this->dir()) . $path . (empty($anchor) ? '' : '#' . $anchor);
}
示例3: form_csrf
function form_csrf()
{
return '<input type="hidden" name="csrf_token" value="' . Security::getCSRFToken() . '"/>';
}
示例4: u
/**
* Generate controller/action url for templates
*
* u('task', 'show', array('task_id' => $task_id))
*
* @param string $controller Controller name
* @param string $action Action name
* @param array $params Url parameters
* @param boolean $csrf Add a CSRF token
* @return string
*/
public function u($controller, $action, array $params = array(), $csrf = false)
{
$values = array('controller' => $controller, 'action' => $action);
if ($csrf) {
$params['csrf_token'] = Security::getCSRFToken();
}
$values += $params;
return '?' . http_build_query($values, '', '&');
}
示例5: u
/**
* URL query string
*
* u('task', 'show', array('task_id' => $task_id))
*
* @param string $controller Controller name
* @param string $action Action name
* @param array $params Url parameters
* @param boolean $csrf Add a CSRF token
* @return string
*/
public function u($controller, $action, array $params = array(), $csrf = false)
{
$html = '?controller=' . $controller . '&action=' . $action;
if ($csrf) {
$params['csrf_token'] = Security::getCSRFToken();
}
foreach ($params as $key => $value) {
$html .= '&' . $key . '=' . $value;
}
return $html;
}
示例6: time
<table id="board" data-project-id="<?php
echo $current_project_id;
?>
" data-time="<?php
echo time();
?>
" data-check-interval="<?php
echo BOARD_CHECK_INTERVAL;
?>
" data-csrf-token=<?php
echo \Core\Security::getCSRFToken();
?>
>
<tr>
<?php
$column_with = round(100 / count($board), 2);
?>
<?php
foreach ($board as $column) {
?>
<th width="<?php
echo $column_with;
?>
%">
<div class="board-add-icon">
<a href="?controller=task&action=create&project_id=<?php
echo $column['project_id'];
?>
&column_id=<?php
echo $column['id'];
?>