本文整理匯總了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);
}