本文整理汇总了PHP中strcut函数的典型用法代码示例。如果您正苦于以下问题:PHP strcut函数的具体用法?PHP strcut怎么用?PHP strcut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strcut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ask
public function ask()
{
$formdata = array();
$formdata['title'] = isset($GLOBALS['title']) ? remove_xss($GLOBALS['title']) : strcut($GLOBALS['content'], 80);
$formdata['content'] = $GLOBALS['content'];
$formdata['addtime'] = SYS_TIME;
$formdata['publisher'] = $this->memberinfo['username'];
$formdata['ip'] = get_ip();
$this->db->insert('guestbook', $formdata);
MSG('您的提问已经提交,我们的专家会尽快给您回复', '?m=guestbook&f=myissue&v=listing');
}
示例2: url
<td align="left"><?php
echo $t['type'];
?>
</td>
<td align="left"><a href="<?php
echo url('admin/index/attack', array('ip' => $t['ip']));
?>
"><?php
echo $t['ip'];
?>
</a></td>
<td align="left"><a href="javascript:view_<?php
echo $k;
?>
();"><?php
echo strcut(htmlspecialchars($t['url']), 50);
?>
</a></td>
</tr>
<?php
}
}
?>
<tr height="25">
<td colspan="8" align="left"><input type="button" class="button" value="<?php
echo lang('a-ind-44');
?>
" name="submit_order" onClick="window.location.href='<?php
echo url('admin/index/clearattack/');
?>
'">
示例3: foreach
foreach ($lastlist as $n => $r) {
if ($nums > 10) {
break;
}
if (!isset($categorys[$r['cid']])) {
continue;
}
$nums++;
?>
<tr>
<td><?php
echo $categorys[$r['cid']]['name'];
?>
</td>
<td><?php
echo "<a href='" . $r['url'] . "' target='_blank'>" . strcut($r['title'], 40, '..') . "</a>";
?>
</td>
<td class="col-md-4">
<?php
echo time_format($r['addtime']);
?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
示例4: foreach
?>
<?php
$n = 1;
if (is_array($rs)) {
foreach ($rs as $r) {
?>
<li><a href="<?php
echo $r['url'];
?>
">
<div class="newstitle"><h3><?php
echo safe_htm($r['title']);
?>
</h3></div></a>
<p><?php
echo safe_htm(strcut(strip_tags($r['content']), 100));
?>
.</p>
</li>
<?php
$n++;
}
}
?>
<?php
if (defined('IN_ADMIN') && !defined('HTML')) {
echo '</div>';
}
?>
</ul>
</div>
示例5: str_replace
?>
</a></div>
<div class="Nbd"><?php
if ($r['thumb']) {
?>
<a href="<?php
echo $r['url'];
?>
"><img src="<?php
echo $r['thumb'];
?>
"></a><?php
}
?>
<p><?php
echo str_replace($keywords, "<font color='#C00'>" . $keywords . "</font>", strcut($r['remark'], 160));
?>
</p>
</div>
<div class="Nfoot">
<div class="lwd">发布时间:<?php
echo date('Y年m月d日 H:i', $r['addtime']);
?>
</div>
</div>
</div>
<?php
$n++;
}
}
?>
示例6: strcut
?>
" class="list-group-item_g"><?php
echo strcut($r['title'], 36);
?>
</a>
<?php
} else {
?>
<a href="<?php
echo $r['url'];
?>
" class="list-group-item_g"><span class="badge"><?php
echo date('y-d', $r['addtime']);
?>
</span>· <?php
echo strcut($r['title'], 32);
?>
</a><?php
}
$n++;
}
}
?>
<?php
if (defined('IN_ADMIN') && !defined('HTML')) {
echo '</div>';
}
?>
</div>
</div>
</div>
示例7: strcut
<tr>
<td class="orderlist"><?php
echo $r['orderid'];
?>
</td>
<td class="orderlist"><a href="<?php
echo $r['url'];
?>
" target="_blank"><div class="orderproimg"><img src="<?php
echo $r['thumb'];
?>
" title="<?php
echo $r['remark'];
?>
"><span><?php
echo strcut($r['remark'], 30);
?>
</span></div></a></td>
<td class="orderlist"><?php
echo date('Y-m-d H:i', $r['addtime']);
?>
</td>
<td class="orderlist"><?php
echo $status[$r['status']];
?>
</td>
<td class="orderlist"><?php
echo $r['point'];
?>
</td>
</tr>
示例8: set
/**
* 添加、修改内容数据
*/
public function set($id, $tablename, $data)
{
$id = intval($id);
if (!$this->is_table_exists($tablename)) {
return lang('m-con-37', array('1' => $tablename));
}
$table = Controller::model($tablename);
//加载附表Model
if (empty($data['catid'])) {
return lang('m-con-8');
}
$_data = $id ? $this->find($id) : null;
//数组转化为字符
foreach ($data as $i => $t) {
if (is_array($t)) {
$data[$i] = array2string($t);
}
}
//描述截取
if (empty($data['description']) && isset($data['content'])) {
$len = isset($data['fn_add_introduce']) && $data['fn_add_introduce'] && $data['fn_introcude_length'] ? $data['fn_introcude_length'] : 200;
$data['description'] = str_replace(array(PHP_EOL, ' '), array('', ''), strcut(clearhtml($data['content']), $len));
}
//下载远程图片
if (isset($data['content']) && isset($data['fn_down_image']) && $data['fn_down_image']) {
$content = str_replace(array('\\', '"'), array('', '\''), htmlspecialchars_decode($data['content']));
if (preg_match_all("/(src)=([\"|']?)([^ \"'>]+\\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $imgs)) {
$userid = !$data['sysadd'] && $data['userid'] ? $data['userid'] : (!$_data['sysadd'] && $_data['userid'] ? $_data['userid'] : 0);
$sysadd = $data['sysadd'] ? $data['sysadd'] : ($_data['sysadd'] ? $_data['sysadd'] : 0);
if ($userid) {
//表示会员投稿
$member = $this->execute("select groupid from {$this->prefix}member where id=" . $userid, false);
$group = $this->execute("select * from {$this->prefix}member_group where id=" . (int) $member['groupid'], false);
$result = $this->download_images($imgs[3], $userid, (int) $group['filesize']);
} elseif ($sysadd) {
//表示管理员投稿
$result = $this->download_images($imgs[3]);
}
if (isset($result) && $result) {
$image = $result['replace'][0];
$data['content'] = str_replace($result['regex'], $result['replace'], $data['content']);
}
}
}
//提取缩略图
if (empty($data['thumb']) && isset($data['content']) && isset($data['fn_auto_thumb']) && $data['fn_auto_thumb']) {
if (isset($image)) {
$data['thumb'] = $image;
} else {
$content = str_replace(array('\\', '"'), array('', '\''), htmlspecialchars_decode($data['content']));
if (preg_match("/(src)=([\"|']?)([^ \"'>]+\\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $img)) {
$data['thumb'] = $img[3];
}
}
}
//关键字处理
if ($data['keywords']) {
$data['keywords'] = str_replace(',', ',', $data['keywords']);
$tags = @explode(',', $data['keywords']);
if ($tags) {
foreach ($tags as $t) {
$name = trim($t);
if ($name) {
$d = $this->from('tag', 'id')->where('name=?', $name)->select(false);
if (empty($d)) {
$this->query('INSERT INTO `' . $this->prefix . 'tag` (`name`,`letter`) VALUES ("' . $name . '", "' . word2pinyin($name) . '")');
}
}
}
}
}
$status = 1;
//用于判断积分增加
$is_add = 0;
if ($id) {
//修改
if (empty($_data)) {
$data['id'] = $id;
$data['url'] = getUrl($data);
//更新URL
$data['status'] = 1;
//插入时状态设置为1
$this->insert($data);
$table->insert($data);
$is_add = 1;
} else {
$data['id'] = $data['id'] ? $data['id'] : $id;
$data['url'] = getUrl($data);
//更新URL
unset($data['id']);
$data['status'] = $data['status'] > 0 ? 1 : 0;
//修改时,非0状态设置为1
$this->update($data, 'id=' . $id);
$table->update($data, 'id=' . $id);
$status = 0;
//修改时不作为积分处理
$data['userid'] = $_data['userid'];
//.........这里部分代码省略.........
示例9: site_url
echo site_url('decoration/article/' . $v['id']);
?>
"><img src="<?php
echo UPLOAD_URL . tag_photo($v['photo']);
?>
" alt="" width="134" height="94"></a>
<div class="nwstext">
<a href="<?php
echo site_url('decoration/article/' . $v['id']);
?>
"><h4><?php
echo strcut(strip_tags($v['title']), 30);
?>
</h4></a>
<p><?php
echo strcut(strip_tags($v['content']), 80);
?>
</p>
<div class="check"><a href="<?php
echo site_url('decoration/article/' . $v['id']);
?>
">查看详情</a></div>
</div>
</div>
<?php
}
?>
</div>
<div class="text-center">
<?php
echo $pages;
示例10: site_url
?>
<li class="list"><a href="<?php
echo site_url('Cases/article/' . $v['id']);
?>
" class="img"><img src="<?php
echo UPLOAD_URL . tag_photo($v['photo']);
?>
" alt="" width="200" height="150" /></a>
<h3><a href="<?php
echo site_url('Cases/article/' . $v['id']);
?>
">【<?php
echo one_ctype($v['ctype'])['title'];
?>
】<?php
echo strcut(strip_tags($v['title']), 12);
?>
</a></h3>
</li>
<?php
}
?>
</ul>
<div class="clear"></div>
</div>
<div class="text-center"><?php
echo $pages;
?>
</div>
</div>
</div>
示例11: additionalAction
/**
* 附加
*/
private function additionalAction($data)
{
$data['keywords'] = str_replace(array(',', ' '), ',', $data['keywords']);
$content = htmlspecialchars_decode($data['content']);
if (empty($data['description']) && isset($data['content']) && isset($data['xiao_auto_description'])) {
$data['description'] = str_replace(array(' ', ' '), array('', ''), strcut(strip_tags($content), 200));
}
if (isset($data['content']) && $data['xiao_download_image'] && $this->site_config['site_download_image']) {
if (preg_match_all("/(src)=([\"|']?)([^ \"'>]+\\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $imgs)) {
$images = array_unique($imgs[3]);
$regex = $replace = array();
$path = 'data/upload/image/' . date('Ym') . '/';
if (!is_dir(XIAOCMS_PATH . $path)) {
mkdirs(XIAOCMS_PATH . $path);
}
$image = xiaocms::load_class('image');
foreach ($images as $img) {
if (strpos($img, SITE_URL) !== false || substr($img, 0, 7) != 'http://') {
continue;
}
$fileext = fileext($img);
$name = $path . md5($img . time()) . '.' . $fileext;
$content = @file_get_contents($img);
if (empty($content)) {
continue;
}
if (file_put_contents(XIAOCMS_PATH . $name, $content)) {
if ($this->site_config['site_watermark']) {
$image->watermark(XIAOCMS_PATH . $name, $this->site_config['site_watermark_pos']);
}
}
$regex[] = $img;
$replace[] = SITE_PATH . $name;
}
}
$result = count($regex) > 0 ? array('regex' => $regex, 'replace' => $replace) : null;
if (isset($result) && $result) {
$image = $result['replace'][0];
$data['content'] = str_replace($result['regex'], $result['replace'], $data['content']);
}
}
if (empty($data['thumb']) && isset($data['content']) && isset($data['xiao_auto_thumb'])) {
if (preg_match("<img.*src=[\"](.*?)[\"].*?>", htmlspecialchars_decode($data['content']), $regs)) {
$data['thumb'] = $regs[1];
}
}
return $data;
}
示例12: extract
<ul>
<?php
$return_m = $this->_listdata("catid={$cid} num=5 order=listorder_asc,inputtime_desc return=m");
extract($return_m);
$count_m = count($return_m);
if (is_array($return_m)) {
foreach ($return_m as $key_m => $m) {
?>
<li><b><a href="<?php
echo $m['url'];
?>
" title="<?php
echo $m['title'];
?>
"><?php
echo strcut($m['title'], 60, '...');
?>
</a></b><span>[<?php
echo date('Y-m-d', $m['inputtime']);
?>
]</span></li>
<?php
}
}
?>
</ul>
</div>
<?php
}
}
}
示例13: response_msg
protected function response_msg($data)
{
$str = '';
if ($data['type'] == 'news') {
$str .= '<xml>' . PHP_EOL;
$str .= '<ToUserName><![CDATA[' . $data['to'] . ']]></ToUserName>' . PHP_EOL;
$str .= '<FromUserName><![CDATA[' . $data['from'] . ']]></FromUserName>' . PHP_EOL;
$str .= '<CreateTime>' . time() . '</CreateTime>' . PHP_EOL;
$str .= '<MsgType><![CDATA[' . $data['type'] . ']]></MsgType>' . PHP_EOL;
$str .= '<ArticleCount>' . (count($data['content']['orther']) + 1) . '</ArticleCount>' . PHP_EOL;
$str .= '<Articles>' . PHP_EOL;
$url = $data['content']['url'];
$str .= '<item>' . PHP_EOL;
$str .= '<Title><![CDATA[' . strcut($data['content']['title'], 28) . ']]></Title>' . PHP_EOL;
$str .= '<Description><![CDATA[' . $data['content']['description'] . ']]></Description>' . PHP_EOL;
$str .= '<PicUrl><![CDATA[' . getImage($data['content']['thumb']) . ']]></PicUrl>' . PHP_EOL;
$str .= '<Url><![CDATA[' . $url . ']]></Url>' . PHP_EOL;
$str .= '</item>' . PHP_EOL;
if ($data['content']['orther']) {
foreach ($data['content']['orther'] as $i => $t) {
$ourl = isset($t['url']) && $t['url'] ? $t['url'] : $url . '&page=' . $i;
$str .= '<item>' . PHP_EOL;
$str .= '<Title><![CDATA[' . strcut($t['title'], 28) . ']]></Title>' . PHP_EOL;
$str .= '<Description><![CDATA[' . $t['content'] . ']]></Description>' . PHP_EOL;
$str .= '<PicUrl><![CDATA[' . getImage($t['thumb']) . ']]></PicUrl>' . PHP_EOL;
$str .= '<Url><![CDATA[' . $ourl . ']]></Url>' . PHP_EOL;
$str .= '</item>' . PHP_EOL;
}
}
$str .= '</Articles>' . PHP_EOL;
$str .= '</xml>';
} else {
$str .= '<xml>' . PHP_EOL;
$str .= '<ToUserName><![CDATA[' . $data['to'] . ']]></ToUserName>' . PHP_EOL;
$str .= '<FromUserName><![CDATA[' . $data['from'] . ']]></FromUserName>' . PHP_EOL;
$str .= '<CreateTime>' . time() . '</CreateTime>' . PHP_EOL;
$str .= '<MsgType><![CDATA[' . $data['type'] . ']]></MsgType>' . PHP_EOL;
$str .= '<Content><![CDATA[' . $data['content'] . ']]></Content>' . PHP_EOL;
$str .= '<MsgId>' . $data['id'] . '</MsgId>' . PHP_EOL;
$str .= '</xml>';
}
return $str;
}
示例14: foreach
$n = 1;
if (is_array($rs)) {
foreach ($rs as $r) {
$attach = unserialize($r['attach']);
?>
<a href="<?php
echo $r['url'];
?>
" class="list-group-item">
<h4 class="list-group-item-heading"><span class="badge"><?php
echo $categorys[$attach['cid']]['name'];
?>
</span> <?php
echo strcut($r['title'], 40);
?>
</h4>
<p class="list-group-item-text"> <?php
echo strcut($r['remark'], 50);
?>
</p>
</a>
<?php
$n++;
}
}
?>
</div>
<?php
if (defined('IN_ADMIN') && !defined('HTML')) {
echo '</div>';
}
示例15: strcut
echo $r['message_id'];
?>
)"><?php
echo $r['user_id'] ? $r['user_name'] : '游客';
?>
</a></td>
<td align="center"><?php
echo $r['ip'];
?>
</td>
<td align="center"><?php
echo '<a href="javascript:;" onclick="show_content(' . $r['message_id'] . ')">' . ($r['title'] ? strcut($r['title'], 20) : strcut($r['content'], 20)) . '</a>';
?>
</td>
<td align="center"><?php
echo strcut($r['last_reply'], 15);
?>
</td>
<td align="center"><?php
echo date('Y-m-d H:i:s', $r['inputtime']);
?>
</td>
<td align="center"><?php
if ($r['status'] == 0) {
?>
隐藏<?php
} else {
?>
显示 <?php
}
?>