本文整理汇总了PHP中core::safe_str方法的典型用法代码示例。如果您正苦于以下问题:PHP core::safe_str方法的具体用法?PHP core::safe_str怎么用?PHP core::safe_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::safe_str方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
默认页
@param void
@return void
*/
function indexAction()
{
$data = [];
$cond = [];
$url = '/admin/replace/index?1=1';
if ($this->getRequest()->getQuery('dosubmit')) {
$url .= '&dosubmit=dosubmit';
if ($id = intval($this->getRequest()->getQuery('id'))) {
$cond['id'] = $id;
$url .= '&id=' . $cond['id'];
}
if ($Keywords = core::safe_str($this->getRequest()->getQuery('keywords'))) {
$cond['keywords'] = $Keywords;
$url .= '&Keywords=' . $cond['keywords'];
}
$this->getView()->assign('cond', $cond);
}
$page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1;
//每页显示数
$offset = 15;
$start = ($page - 1) * $offset;
$data['data'] = $this->Keyword->search_replacewords_list($cond, $start, $offset);
$total = $this->Keyword->count($cond, 'keywords');
$totalpage = ceil($total / $offset);
//超过一页显示分页
if ($totalpage > 1) {
$url .= '&page=';
$data['page'] = (new multi())->getSubContent($url, '', $totalpage, $page, 20, ' target="_self" ', '', '', 'no');
}
//每页实际显示数
$data['perNum'] = $page > $totalpage ? 0 : $page == $totalpage ? $total % $offset : $offset;
$this->getView()->assign('data', $data);
}
示例2: editAction
public function editAction()
{
$id = intval($this->getRequest()->getQuery('id'));
if ($this->getRequest()->isPost()) {
$value = ['username' => core::safe_str($this->getRequest()->getPost('username')), 'name' => core::safe_str($this->getRequest()->getPost('name')), 'nickname' => core::safe_str($this->getRequest()->getPost('nickname')), 'gender' => intval($this->getRequest()->getPost('gender')), 'phone' => core::safe_str($this->getRequest()->getPost('phone')), 'email' => core::is_email($this->getRequest()->getPost('email')) ? $this->getRequest()->getPost('email') : NULL, 'status' => intval($this->getRequest()->getPost('status')), 'birthday' => misc::is_date($this->getRequest()->getPost('birthday'), '-') ? strtotime($this->getRequest()->getPost('birthday')) : NULL];
if ($this->member->update($value, ['id' => intval($this->getRequest()->getPost('id'))])) {
Alert::success('更新成功!');
} else {
Alert::success('没有任何变化!');
}
$this->redirect($this->getRequest()->getPost('referer'));
} else {
if ($data = $this->member->getMemberByAttribute(['id' => $id])) {
$data['referer'] = $_SERVER["HTTP_REFERER"];
$this->getView()->assign('data', $data);
} else {
Alert::success('没有此用户!');
$this->redirect('/admin/managemember/index');
}
}
}
示例3: indexAction
/**
默认页
@param void
@return void
*/
function indexAction()
{
$data = [];
$cond = [];
$cond['status'] = 99;
$url = '/admin/document/index?1=1';
$page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1;
if ($this->getRequest()->getQuery('catsubmit')) {
$url .= '&catsubmit=catsubmit';
if ($catid = intval($this->getRequest()->getQuery('catid'))) {
$cond['catid'] = $catid;
$url .= '&catid=' . $cond['catid'];
}
if ($title = core::safe_str($this->getRequest()->getQuery('title'))) {
$cond['title'] = $title;
$url .= '&title=' . $cond['title'];
}
$data['data'] = $this->category->catelist($cond['catid']);
$this->getView()->assign('cond', $cond);
}
//每页显示数
$offset = 50;
$start = ($page - 1) * $offset;
$category_list = $this->category->catelist();
$data['data'] ? $data['data'] : ($data['data'] = $category_list);
//总页数
$total = $this->category->get_category_count();
$totalpage = ceil($total / $offset);
//超过一页显示分页
if ($totalpage > 1) {
$data['page'] = (new multi())->getSubContent('/admin/category/index?page=', '', $totalpage, $page, 9, ' target="_self" ', '', '', 'no');
}
$this->getView()->assign('data', $data);
//格式化栏目列表
//$category_list_format = $this->treeForCategory($category_list, 7);
$this->getView()->assign('category_list', $category_list);
}
示例4: dexAction
/**
默认页
@param void
@return void
*/
function dexAction()
{
$data = [];
$cond = [];
$url = '/admin/page/index?1=1';
if ($this->getRequest()->getQuery('dosubmit')) {
$url .= '&dosubmit=dosubmit';
if ($id = intval($this->getRequest()->getQuery('id'))) {
$cond['id'] = $id;
$url .= '&id=' . $cond['id'];
}
if ($catid = intval($this->getRequest()->getQuery('catid'))) {
$cond['catid'] = $catid;
$url .= '&catid=' . $cond['catid'];
}
if ($title = core::safe_str($this->getRequest()->getQuery('title'))) {
$cond['title'] = $title;
$url .= '&title=' . $cond['title'];
}
$this->getView()->assign('cond', $cond);
}
$page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1;
//栏目
$data['category'] = $this->category->categoryList(['parentid' => 7], 0, 50);
//每页显示数
$offset = 20;
$start = ($page - 1) * $offset;
$data['data'] = $this->page->pageList($cond, $start, $offset);
$total = $this->page->count($cond);
$totalpage = ceil($total / $offset);
//超过一页显示分页
if ($totalpage > 1) {
$url .= '&page=';
$data['page'] = (new multi())->getSubContent($url, '', $totalpage, $page, 20, ' target="_self" ', '', '', 'no');
}
//每页实际显示数
$data['perNum'] = $page > $totalpage ? 0 : $page == $totalpage ? $total % $offset : $offset;
$this->getView()->assign('data', $data);
}