本文整理匯總了PHP中string::split_word方法的典型用法代碼示例。如果您正苦於以下問題:PHP string::split_word方法的具體用法?PHP string::split_word怎麽用?PHP string::split_word使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類string
的用法示例。
在下文中一共展示了string::split_word方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: resume
public function resume()
{
$auth = new auth();
if (!$auth->is_logged_in()) {
$this->error(L('please_login'), 'auth/index');
}
if (!$auth->check_uri_permissions()) {
$this->error($auth->error);
}
$db = M('model_field');
$filterCond = array();
//處理選項搜索字段
$switch_field = $db->field('title,field_name')->where('field_type="switch" and join_index=1 and dmid=6')->findall();
$model_struct = (include PATH_ROOT . '/caches/model/field/m_resume_basic.php');
foreach ($switch_field as $value) {
$filterCond['switchs'][$value['field_name']] = $model_struct[$value['field_name']]['data'];
}
//處理選項聯動搜索字段
$linkage_filed = $db->field('title,field_name,lcgid')->where('field_type="linkage" and join_index=1 and dmid=6')->findall();
foreach ($linkage_filed as $value) {
$data = $db->table('linkage')->cache(86400)->field('laid,title')->where('lcgid=' . $value['lcgid'])->findall();
$filterCond['linkages'][$value['field_name']] = array('title' => $value['title'], 'data' => $data);
}
//處理選項地區搜索字段
$filterCond['address'] = $db->table('city')->cache(86400)->field('id,name,direct')->where('pid=0')->findall();
//地區
if (isset($_GET['address'])) {
$filterCond['sonAddress'] = $db->table('city')->cache(86400)->field('id,name')->where('pid=' . $_GET['address'])->findall();
//地區子類
}
$where = array('open' => 1, 'verify' => 1);
//resume表的條件:公開已驗證
if (isset($_GET['address'])) {
//地址
$where[] = 'hope_provice=' . intval($_GET['address']);
}
if (isset($_GET['city'])) {
//地址
$where[] = 'hope_city=' . intval($_GET['city']);
}
if (isset($_GET['work_exp'])) {
//工作經驗
$where[] = 'work_exp=' . intval($_GET['work_exp']);
}
if (isset($_GET['updated'])) {
//更新時間
$where['updated'] = 'updated >' . strtotime('-' . $_GET['updated'] . 'days');
}
$keywords = array();
if (!empty($_GET['keywords'])) {
//關鍵字
$_GET['keywords'] = strip_tags($_GET['keywords']);
$keywords = array_keys(string::split_word($_GET['keywords']));
$keyword_cond = '';
foreach ($keywords as $value) {
$keyword_cond .= 'resume_name LIKE "%' . $value . '%" OR ';
}
$keyword_cond = rtrim($keyword_cond, 'OR ');
$where[] = $keyword_cond;
}
$db = V('resume');
$db->view = array('resume_basic' => array('type' => 'INNER', 'on' => 'resume.resume_id=resume_basic.resume_id'));
$nums = $db->where($where)->count();
$page = new page($nums, 10);
$resumes = $db->where($where)->findall($page->limit());
if ($resumes) {
$data_class = new data('resume_basic');
foreach ($resumes as $key => $value) {
$resumes[$key] = $data_class->convert($value);
}
}
$this->assign('resumes', $resumes);
$this->assign('filterCond', $filterCond);
$this->assign('page', $page->show());
$this->display('search-resume');
}
示例2: addArc
public function addArc()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (empty($_POST['keywords'])) {
//生成關鍵字
$_POST['keywords'] = implode(',', array_keys(string::split_word($_POST['title'])));
}
if (empty($_POST['summary'])) {
//生成描述
$_POST['summary'] = mb_substr(strip_tags($_POST['contents']), 0, 100, 'utf-8');
} else {
$_POST['summary'] = strip_tags($_POST['summary']);
}
if (empty($_POST['created'])) {
//處理創建時間
$_POST['created'] = time();
} else {
$_POST['created'] = strtotime($_POST['created']);
}
$_POST['uid'] = $_SESSION['uid'];
$_POST['updated'] = $_POST['created'];
$data = array();
if ($id = $this->arc->addArc($_POST)) {
// $channel=$this->arc->channel('id='.$_POST['cid'],'setting,pinyin,style,con_tpl');
// $channel['setting']=json_decode($channel['setting'],true);
// if($channel['setting']['con_html']){//如果生成文章靜態HTML
// $path="/html/{$channel['pinyin']}/".date('Ymd',$_POST['created']);
// $tpl=PATH_ROOT.'/templates/'.$channel['style'].'/content/'.$channel['con_tpl'];//內容頁模板
// $this->generate_arc_html($id,$path,$tpl);
// $data['href']=$path."/arc_{$id}.html";
// }else{
// $data['href']='/content/index/arc/id/'.$id;
// }
if ($c_info = $this->_decide_generate_html($_POST['cid'], $id)) {
$data['href'] = __ROOT__ . $c_info['path'] . "/arc_{$id}.html";
} else {
$data['href'] = __WEB__ . '/content/index/arc/id/' . $id;
}
$this->arc->updateArc('id=' . $id, $data);
//更新文章的href
$this->success('添加文章成功!', __CONTROL__ . '/channelArc/cid/' . $_POST['cid']);
}
}
$channels = $this->arc->channels(array(), 'title,id,pid,path');
$this->assign('channels', $channels);
$this->display();
}
示例3: issueRecruit
/**
* 企業發布招聘信息
*/
function issueRecruit()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$_POST['uid'] = $_SESSION['uid'];
/* 發布時間 */
if ($_POST['issue_type'] == '1') {
$_POST['start_time'] = time();
} else {
$_POST['start_time'] = strtotime($_POST['start_time']);
}
/* 計算到期時間 */
$_POST['expiration_time'] = $_POST['start_time'] + $_POST['effective_time'] * 24 * 60 * 60;
if (C('VERIFY_RECRUIT')) {
//如果開啟了審核職位:0未通過,1通過,2審核中
$_POST['verify'] = 2;
} else {
$_POST['verify'] = 1;
}
if (empty($_POST['seo_desc'])) {
//職位簡要
$_POST['seo_desc'] = mb_substr(strip_tags($_POST['job_desc']), 0, 80, 'UTF-8');
}
$field = new field(5);
$_POST = $field->filterField($_POST);
$_POST['created'] = time();
//添加時間
//處理SEO關鍵字(截取職位名稱)
$_POST['seo_keywords'] = implode(',', array_keys(string::split_word($_POST['recruit_name'])));
$_POST['refresh_date'] = $_POST['start_time'];
$point = abs(getPointRule('issueRecruit'));
//獲得應扣取積分
$point *= $_POST['effective_time'];
if ($_SESSION['point'] < $point) {
$this->error('親愛的用戶,你的積分不夠啦。請聯係管理員充值');
}
$result = $this->recruit->addRecruit($_POST);
if ($result) {
deductPoint(-$point);
//扣取積分
$con = '發布一個職位信息--<a href="' . __APP__ . '/search/jobs/id/' . $result . '" target="_blank">' . $_POST['recruit_name'] . '</a> 有效期:' . $_POST['effective_time'] . '天,共花費:' . $point . '積分。';
writeOptLog($con, -$point);
//寫入日誌
$this->success('發布招聘成功', 'index');
} else {
$this->error('發布招聘失敗');
}
}
$this->display('company/issueRecruit');
}