本文整理汇总了PHP中Arr::string_to_int方法的典型用法代码示例。如果您正苦于以下问题:PHP Arr::string_to_int方法的具体用法?PHP Arr::string_to_int怎么用?PHP Arr::string_to_int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arr
的用法示例。
在下文中一共展示了Arr::string_to_int方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSitePost
public function doSitePost()
{
$webPage = new WebPage();
if (IS_POST) {
$data = json_decode($_POST['data'], TRUE);
$webPage->save($data);
message('保存快捷菜单成功', 'refresh', 'success');
}
$field = Db::table('web_page')->where('siteid', SITEID)->where('type', 1)->first() ?: [];
if ($field) {
$field = Arr::string_to_int($field);
$field['params'] = json_decode($field['params']);
}
return view($this->template . '/quickmenu/post.php')->with('field', $field);
}
示例2: post
public function post()
{
if (IS_POST) {
$data = json_decode($_POST['data'], TRUE);
$data['css']['size'] = min(intval($data['css']['size']), 100);
$this->webNav->save($data);
message('保存导航数据成功', $_POST['__HISTORY__'], 'success');
}
//站点列表
$web = Db::table('web')->field('web.id,web.title,template.tid,template.position')->join('template', 'template.name', '=', 'web.template_name')->where('siteid', SITEID)->get();
if ($this->id) {
$field = Db::table('web_nav')->where('id', $this->id)->first();
$field['css'] = empty($field['css']) ? [] : json_decode($field['css'], TRUE);
} else {
//新增数据时初始化导航数据,只有通过官网添加导航链接才有效,模块的只有编辑操作,所以模块一定有数据
$field['siteid'] = SITEID;
$field['position'] = 0;
$field['icontype'] = 1;
$field['status'] = 1;
$field['orderby'] = 0;
$field['entry'] = 'home';
$field['css'] = ['icon' => 'fa fa-external-link', 'image' => '', 'color' => '#333333', 'size' => 35];
$field['web_id'] = $this->webid;
}
View::with('web', Arr::string_to_int($web));
View::with('field', Arr::string_to_int($field));
return view();
}
示例3: doSiteArticlePost
public function doSiteArticlePost()
{
$aid = Request::get('aid');
if ($aid && !Db::table('web_article')->find($aid)) {
message('文章不存在', 'back', 'error');
}
if (IS_POST) {
$data = json_decode($_POST['data'], TRUE);
$insertId = $this->webArticle->save($data);
$aid = $aid ?: $insertId;
//回复规则与回复关键词设置
if (!empty($data['keyword']) && !empty($data['thumb'])) {
$rule['rid'] = Db::table('reply_cover')->where('module', 'article:aid:' . $aid)->pluck('rid');
$rule['name'] = "微站文章:{$aid}";
$rule['module'] = 'news';
//添加回复关键词
$rule['keywords'] = [['content' => $data['keyword']]];
$rid = service('WeChat')->rule($rule);
//添加封面回复
$ReplyNews = new ReplyNews();
$data['rid'] = $rid;
$data['module'] = 'article:aid:' . $aid;
$data['url'] = $data['linkurl'] ?: '?a=entry/content&m=article&t=web&siteid=' . SITEID . '&aid=' . $aid;
$ReplyNews->save($data);
$this->webArticle->update(['aid' => $aid, 'rid' => $rid]);
}
message('保存文章成功', site_url('article', ['cid' => $data['category_cid']]), 'success');
}
//栏目列表
$category = $this->webCategory->getLevelCategory();
if (empty($category)) {
message('请先添加文章类别', 'category', 'error');
}
//所有模板数据用于设置文章模板
$template = service('template')->getSiteAllTemplate();
//获取文章数据
if ($aid) {
$field = DB::table('web_article')->find($aid);
}
View::with('field', Arr::string_to_int($field));
View::with('template', Arr::string_to_int($template));
View::with('category', Arr::string_to_int($category));
return View::make($this->template . '/content/articlePost.php');
}