本文整理汇总了PHP中tool::cn_substr方法的典型用法代码示例。如果您正苦于以下问题:PHP tool::cn_substr方法的具体用法?PHP tool::cn_substr怎么用?PHP tool::cn_substr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tool
的用法示例。
在下文中一共展示了tool::cn_substr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_action
function add_action() {
if($this->table == 'category'){
chkpw('category_add');
}
if($this->table == 'archive'){
chkpw('archive_add');
}
if($this->table == 'type'){
chkpw('type_add');
front::$post['typecontent'] = htmlspecialchars_decode(front::$post['typecontent']);
}
if($this->table == 'special'){
chkpw('special_add');
front::$post['description'] = htmlspecialchars_decode(front::$post['description']);
}
if($this->table == 'user'){
chkpw('user_add');
}
if($this->table == 'usergroup'){
chkpw('usergroup_add');
}
if($this->table == 'ballot'){
chkpw('func_ballot_add');
}
if($this->table == 'announcement'){
chkpw('func_announc_add');
front::$post['content'] = htmlspecialchars_decode(front::$post['content']);
}
if($this->table == 'templatetag' && front::get('tagfrom') == 'define'){
chkpw('templatetag_add_define');
}
if($this->table == 'templatetag' && front::get('tagfrom') == 'category'){
chkpw('templatetag_add_category');
}
if($this->table == 'templatetag' && front::get('tagfrom') == 'content'){
chkpw('templatetag_add_content');
}
if($this->table == 'linkword'){
chkpw('seo_linkword_add');
}
if($this->table == 'friendlink'){
chkpw('seo_friendlink_add');
}
//用户异步提取图库图片
if(front::$get['ajax']){
front::$get['dir'] = front::$get['ajax'];
$img_arr = image_admin::listimg_action();
foreach($img_arr as $v){
echo '<img src="upload/images/'.front::$get['dir'].'/'.$v.'" id="img'.str_replace('.','',$v).'" onClick="select_img(\'img'.str_replace('.','',$v).'\');" />';
}
exit();
}
if (front::post('submit') &&$this->manage->vaild()) {
$this->manage->filter($this->Exc);
$this->manage->add_before($this);
$this->manage->save_before();
front::$post['catname']=str_replace(' ',' ',front::$post['catname']);
front::$post['htmldir']=str_replace(' ','_',front::$post['htmldir']);
if(front::$post['introduce'] == ''){
front::$post['introduce'] = tool::cn_substr(preg_replace('/&(.*?);/is','', strip_tags(front::$post['content'])),200);
}
if($this->table == 'user'){
//var_dump($_SESSION);
if(!Phpox_token::is_token('user_add', front::$post['token'])){
exit('非法参数');
}
}
if ($this->table == 'templatetag') {
if(front::$post['tagfrom']!='define' && !preg_match('/^tag_(.*?)+\.html$/is', front::$post['tagtemplate'])){
exit('参数非法');
}
}
if($this->table == 'category'){
if (front::$post['addtype'] == 'single') {
if (!front::$post['htmldir']) {
front::$post['htmldir'] = pinyin::get(front::$post['catname']);
}
$insert=$this->_table->rec_insert(front::$post);
if ($insert <1) {
front::flash("{$this->tname}添加失败!");
}else{
$_insertid=$this->_table->insert_id();
$this->manage->save_after($_insertid);
}
} else {
$catearr = explode("\n", front::$post['batch_add']);
foreach ($catearr as $cates) {
$catetmp = explode("|", $cates);
if ($catetmp[0] != '') {
front::$post['catname'] = $catetmp[0];
front::$post['htmldir'] = $catetmp[1];
if ($catetmp[1] == '') {
front::$post['htmldir'] = pinyin::get($catetmp[0]);
}
$insert = $this->_table->rec_insert(front::$post);
if ($insert <1) {
front::flash("{$this->tname}添加失败!");
//.........这里部分代码省略.........
示例2: cut
function cut($string,$length=20) {
return tool::cn_substr(strip_tags($string),$length,config::get('database','encoding'));
}
示例3: cut
echo cut($d['id']);
?>
&="></script></span></td></tr>
</table>
</td>
<td><?php
if ($d['tagcontent'] == 'null') {
$id = $d['id'];
$path = ROOT . '/config/tag/' . get('tagfrom') . '_' . $id . '.php';
$tag_config = array();
$tag_config_content = @file_get_contents($path);
$tag_config = unserialize($tag_config_content);
echo $tag_config['tagtemplate'];
} else {
echo tool::cn_substr(htmlspecialchars($d['tagcontent']), 20);
}
?>
</td>
<td align="center" width="100">
<span class="hotspot" onmouseover="tooltip.show('预览标签效果!');" onmouseout="tooltip.hide();">
<a href='<?php
echo url("templatetag/test/id/{$d[$primary_key]}", false);
?>
' target="_blank" class="a_view"></a>
</span>
<?php
if ($_GET['tagfrom'] != 'function') {