当前位置: 首页>>代码示例>>PHP>>正文


PHP subString函数代码示例

本文整理汇总了PHP中subString函数的典型用法代码示例。如果您正苦于以下问题:PHP subString函数的具体用法?PHP subString怎么用?PHP subString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了subString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLinks

 function getLinks()
 {
     $res = $this->db->query("SELECT * FROM " . DB_PREFIX . "link ORDER BY taxis ASC");
     $links = array();
     while ($row = $this->db->fetch_array($res)) {
         $row['sitename'] = htmlspecialchars($row['sitename']);
         $row['description'] = subString(htmlClean($row['description'], false), 0, 80);
         $row['siteurl'] = $row['siteurl'];
         $links[] = $row;
     }
     return $links;
 }
开发者ID:MikeCoder,项目名称:mblog,代码行数:12,代码来源:link_model.php

示例2: lastinfo

/**
 * 更新最后回复状态
 * 
 * @param $fid
 * @param $tid
 * @param $type
 * @param $mybbs_id
 * @param $MyDatabase
 * @param $atc_title
 */
function lastinfo($fid, $tid, $type = '', $mybbs_id, $MyDatabase, $atc_title)
{
    $nowtime = date('Y-m-d H:i:s', time());
    $title = subString($atc_title, 24);
    //发帖
    if ($type == 'new') {
        $topicadd = ",topic=topic+1,post=post+1";
    } elseif ($type == 'reply') {
        $topicadd = ",post=post+1";
    }
    $new_url = 'read.php?tid=' . $tid;
    $lastpost = $title . "\t" . addslashes($mybbs_id) . "\t" . $nowtime . "\t" . $new_url;
    //更新最后回复时间
    $SqlStr = 'UPDATE `' . DB_TABLE_PRE . 'forums` SET `lastpost`=\'' . $lastpost . '\'' . $topicadd . '   WHERE `fid`=' . $fid;
    $MyDatabase->SqlStr = $SqlStr;
    if ($MyDatabase->ExecuteQuery()) {
    } else {
        echo '文件:' . __FILE__;
        echo '<br />行数:' . __LINE__;
        echo '<br />原因:';
        DebugStr($MyDatabase->SqlStr);
        ErrorMsg('更新首页显示栏目最新发帖失败!');
    }
}
开发者ID:Zerolone,项目名称:mybbs,代码行数:34,代码来源:postfunc.php

示例3: getArticleRightRank

/**
 * 文章排行
 * @author   Zerolone
 * @version  2008年10月27日11:27:44
 * @param		cateid			栏目编号				默认为0, 可以为一个栏目编号, 或者多个栏目。例如:12, 或者12,13
 * @param		count				记录数					默认为10
 * @param		titlecount 	文字显示数			默认为20
 * @return 列表字符串
 */
function getArticleRightRank($cateid = 0, $count = 10, $titlecount = 44)
{
    $i = 1;
    $ReturnString = '';
    //-------------------0--------1--------2---------3
    $SqlStr = ' SELECT `title`, `html`, `reurl`, `title2` ';
    $SqlStr .= ' FROM `' . DB_TABLE_PRE . 'article` ';
    $SqlStr .= ' WHERE `flag`= 3 ';
    //栏目编号
    if (strpos($cateid, ',')) {
        $SqlStr .= ' AND `cateid` in (' . $cateid . ')';
    } elseif ($cateid > 0) {
        $SqlStr .= ' AND `cateid` =' . $cateid;
    }
    $SqlStr .= ' ORDER BY `hits` DESC';
    $SqlStr .= ' LIMIT ' . $count;
    $MyDatabase = new Database();
    $MyDatabase->SqlStr = $SqlStr;
    if ($MyDatabase->Query()) {
        $DB_Record_Arr = $MyDatabase->ResultArr;
        foreach ($DB_Record_Arr as $DB_Record) {
            $title = subString($DB_Record[0], $titlecount);
            $title2 = $DB_Record[3];
            if ($title2 != '') {
                $title = $title2;
            }
            $url = $DB_Record[1];
            $reurl = $DB_Record[2];
            if ($reurl) {
                $url = $reurl;
            }
            $ReturnString .= '<li class="rank' . $i . '"><a title="' . $DB_Record[0] . '" href="' . $url . '">' . $title . '</a></li>';
            $i++;
        }
    }
    return $ReturnString;
}
开发者ID:Zerolone,项目名称:mysqlea,代码行数:46,代码来源:function.php

示例4: plugin_setting_view


//.........这里部分代码省略.........
                ?>
><a href="./plugin.php?plugin=anti_spam_comment&advance=true&hide=n&<?php 
                echo $addUrl_1 . $addUrl_3;
                ?>
">已审</a></span>
</div>
<?php 
            } elseif ($addUrl) {
                ?>
<div class="filters">
<span><a href="./plugin.php?plugin=anti_spam_comment&advance=true">全部</a></span>
</div>
<?php 
            }
            ?>
<form action="./plugin.php?plugin=anti_spam_comment&advance=true&act=admin_all_coms" method="post" name="form_com" id="form_com">
	<table width="100%" id="adm_comment_list" class="item_list">
		<thead>
			<tr>
				<th width="19"><input onclick="CheckAll(this.form)" type="checkbox" value="on" name="chkall" /></th>
				<th width="350"><b>内容</b></th>
				<th width="300"><b>评论者</b></th>
				<th width="250"><b>所属日志</b></th>
			</tr>
		</thead>
		<tbody>
		<?php 
            while ($res = $DB->fetch_array($query)) {
                $ishide = $res['hide'] == 'y' ? '<font color="red">[待审]</font>' : '';
                $mail = !empty($res['mail']) ? "({$res['mail']})" : '';
                $ip = !empty($res['ip']) ? "<br />IP:<a href=\"./plugin.php?plugin=anti_spam_comment&advance=true&ip={$res['ip']}\">{$res['ip']}</a>" : '';
                $url = !empty($res['url']) ? "({$res['url']})" : '';
                $res['content'] = str_replace('<br>', ' ', $res['comment']);
                $sub_content = subString($res['content'], 0, 50);
                $res['title'] = subString($res['title'], 0, 42);
                ?>
			<tr>
				<td><input type="checkbox" value="<?php 
                echo $res['cid'];
                ?>
" name="com[]" class="ids" /></td>
				<td><a href="./plugin.php?plugin=anti_spam_comment&advance=true&act=edit&cid=<?php 
                echo $res['cid'];
                ?>
"><?php 
                echo htmlspecialchars($sub_content);
                ?>
</a> <?php 
                echo $ishide;
                ?>
				<br /><?php 
                echo smartDate($res['date']);
                ?>
				<span style="display:none; margin-left:8px;">
				<a href="javascript: asc_confirm(<?php 
                echo $res['cid'];
                ?>
, 'name');">屏蔽内容</a>
				<a href="javascript: asc_confirm(<?php 
                echo $res['cid'];
                ?>
, 'url');">删除地址</a>
				</span>
				</td>
				<td><a href="./plugin.php?plugin=anti_spam_comment&advance=true&poster=<?php 
                echo urlencode($res['poster']);
开发者ID:LockGit,项目名称:emlog,代码行数:67,代码来源:anti_spam_comment_setting.php

示例5: blog_tool_purecontent

function blog_tool_purecontent($content, $strlen = null)
{
    $content = str_replace('阅读全文&gt;&gt;', '', strip_tags($content));
    if ($strlen) {
        $content = subString($content, 0, $strlen);
    }
    return $content;
}
开发者ID:szshenjian,项目名称:JIEWU,代码行数:8,代码来源:module.php

示例6: foreach

        <th width="369" colspan="2"><b>内容</b></th>
		<th width="300"><b>评论者</b></th>
        <th width="250"><b>所属文章</b></th>
      </tr>
    </thead>
    <tbody>
	<?php 
if ($comment) {
    foreach ($comment as $key => $value) {
        $ishide = $value['hide'] == 'y' ? '<font color="red">[待审]</font>' : '';
        $mail = !empty($value['mail']) ? "({$value['mail']})" : '';
        $ip = !empty($value['ip']) ? "<br />来自:{$value['ip']}" : '';
        $poster = !empty($value['url']) ? '<a href="' . $value['url'] . '" target="_blank">' . $value['poster'] . '</a>' : $value['poster'];
        $value['content'] = str_replace('<br>', ' ', $value['content']);
        $sub_content = subString($value['content'], 0, 50);
        $value['title'] = subString($value['title'], 0, 42);
        doAction('adm_comment_display');
        ?>
     <tr>
        <td width="19"><input type="checkbox" value="<?php 
        echo $value['cid'];
        ?>
" name="com[]" class="ids" /></td>
        <td width="350"><a href="comment.php?action=reply_comment&amp;cid=<?php 
        echo $value['cid'];
        ?>
" title="<?php 
        echo $value['content'];
        ?>
"><?php 
        echo $sub_content;
开发者ID:MikeCoder,项目名称:mblog,代码行数:31,代码来源:comment.php

示例7: query

页面功能:首页
创建日期:2008年5月7日21:28:16
修改日期:
作    者:Zerolone
主    页:http://www.zerolone.com/
*/
require 'include/common.inc.php';
$page_name = 'index.php';
$SqlStr = ' SELECT `id`, `title`, `import` FROM `' . table_pre . 'calendar` WHERE `userid`=' . $userid;
$SqlStr .= ' AND `isdone`=0';
$SqlStr .= ' ORDER BY `import` DESC , `createtime` ASC';
$SqlStr .= ' LIMIT 0,  10 ';
$temp_query = query($SqlStr);
$i = 0;
while ($DB_Record = nqfetch($temp_query)) {
    $calendar_title = subString($DB_Record[1], 52);
    //关键度颜色
    $calendar_import = $DB_Record[2];
    switch ($calendar_import) {
        case 1:
            $calendar_import_color = "#000000";
            break;
        case 2:
            $calendar_import_color = "#00FF00";
            break;
        case 3:
            $calendar_import_color = "#0000FF";
            break;
        case 4:
            $calendar_import_color = "#FF9966";
            break;
开发者ID:Zerolone,项目名称:mgroupware,代码行数:31,代码来源:index.php

示例8: count

//总记录
$recordcount = 0;
$SqlStr = 'Select count(*) from `' . DB_TABLE_PRE . 'navbar`';
$SqlStr .= ' WHERE `pid`=' . $pid;
$MyDatabase->SqlStr = $SqlStr;
if ($MyDatabase->Query()) {
    $recordcount = $MyDatabase->ResultArr[0][0];
}
//------------------0------1--------2-------3--------4
$SqlStr = 'SELECT `id`, `title`, `order`, `url`, `active` FROM `' . DB_TABLE_PRE . 'navbar`';
$SqlStr .= ' WHERE `pid`=' . $pid;
$SqlStr .= ' ORDER BY `order` ASC';
$SqlStr .= ' LIMIT ' . $pagesize * ($pagenum - 1) . ' ,' . $pagesize . ';';
//echo $SqlStr;
$MyDatabase->SqlStr = $SqlStr;
if ($MyDatabase->Query()) {
    $DB_Record_Arr = $MyDatabase->ResultArr;
    foreach ($DB_Record_Arr as $DB_Record) {
        $navbar_title = subString($DB_Record[1], 76);
        $navbar_active_txt = '使用';
        if ($DB_Record[4] == '0') {
            $navbar_active_txt = '不使用';
        }
        $navbar_list[] = array('id' => $DB_Record[0], 'title' => $navbar_title, 'order' => $DB_Record[2], 'url' => $DB_Record[3], 'active_txt' => $navbar_active_txt);
    }
}
//管理员日志
$log_content = '导航菜单管理 &gt;&gt; 导航菜单查看';
require '../../include/log.php';
require $page_name . '.php';
require '../../include/debug.php';
开发者ID:Zerolone,项目名称:mybbs,代码行数:31,代码来源:navbar.php

示例9: foreach

 if ($MyDatabase1->Query()) {
     $DB_Record_Arr1 = $MyDatabase1->ResultArr;
     foreach ($DB_Record_Arr1 as $DB_Record_Loop) {
         $TempStr = $LoopString;
         $TempTitle = subString($DB_Record_Loop[0], $txt);
         $TempTitle2 = $DB_Record_Loop[6];
         $TempHtml = $DB_Record_Loop[1];
         $TempReUrl = $DB_Record_Loop[2];
         $TempPic1 = $DB_Record_Loop[3];
         $TempPic2 = $DB_Record_Loop[4];
         $TempMemo = $DB_Record_Loop[5];
         $TempMemo = str_replace(Chr(10), "<br />", $TempMemo);
         $TempId = $DB_Record_Loop[7];
         $Tempcustom1 = $DB_Record_Loop[8];
         $TempContent = $DB_Record_Loop[9];
         $TempContent = subString($TempContent, 180);
         $TempPosttime = $DB_Record_Loop[10];
         $TempHits = $DB_Record_Loop[11];
         //指定长标题
         $TempStr = str_replace('{title1}', $TempTitle, $TempStr);
         //标题
         if ($TempTitle2 != '') {
             $TempTitle = $TempTitle2;
         }
         $TempStr = str_replace('{title}', $TempTitle, $TempStr);
         //链接
         if ($TempReUrl == '') {
             $TempStr = str_replace('{html}', $TempHtml, $TempStr);
         } else {
             $TempStr = str_replace('{html}', $TempReUrl, $TempStr);
         }
开发者ID:Zerolone,项目名称:mybbs,代码行数:31,代码来源:update.php

示例10: empty

"></script>
    </head>
    <body>
        <div id="wrapper">
            <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="../" target="_blank" title="在新窗口浏站点">
                        <?php 
$blog_name = Option::get('blogname');
echo empty($blog_name) ? '查看我的站点' : subString($blog_name, 0, 24);
?>
                    </a>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li><a href="./"><i class="fa fa-home fa-fw"></i>管理首页</a></li>
                    <li><a href="./configure.php"><i class="fa fa-wrench fa-fw"></i> 设置</a></li>
                    <li><a href="./?action=logout"><i class="fa fa-power-off fa-fw"></i>退出</a></li>
                </ul>

                <div class="navbar-default sidebar" role="navigation">
                    <div class="sidebar-nav navbar-collapse">
                        <ul class="nav" id="side-menu">
                            <li class="sidebar-avatar">
                                <div style="text-align: center;">
                                    <a href="./blogger.php">
开发者ID:flyysr,项目名称:emlog,代码行数:31,代码来源:header.php

示例11: subString

    if (empty($fa['logTitle'])) {
        $fa['logTitle'] = $strAttachmentNoLogs;
    }
    if ($fa['logId'] < 1) {
        echo "---";
    } else {
        ?>
				<a href="../index.php?load=read&amp;id=<?php 
        echo $fa['logId'];
        ?>
" target="_blank" title="<?php 
        echo $fa['logTitle'];
        ?>
"><?php 
        echo $fa['logId'];
        echo " (" . subString($fa['logTitle'], 0, 5) . ")";
        ?>
</a>
			 <?php 
    }
    ?>
		  </td>
		</tr>
		<?php 
}
//end for
?>
	  </table>
	</div>
	<br>
	<div class="bottombar-onebtn"></div>
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:31,代码来源:attachments_dblist.inc.php

示例12: subString

" title="<?php 
        echo $value['log_title'];
        ?>
上的评论"><?php 
        echo $value['comnum'];
        ?>
</a>
&nbsp;&nbsp;&nbsp;&nbsp;
热度:<span class="wpviews" id="views_135"><?php 
        echo $value['views'];
        ?>
</span>
</div>
<div class="post-content">
<?php 
        echo subString(strip_tags($value['log_description']), 0, 128, "...");
        ?>
</div>
<div class="post-meta">
生产日期:<?php 
        echo gmdate('Y-n-j', $value['date']);
        ?>
  |  关键字:
<?php 
        blog_tag($value['logid']);
        ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php 
        editflg($value['logid'], $value['author']);
        ?>
</div>
</div>
开发者ID:zhaozhiliang,项目名称:emblog531,代码行数:31,代码来源:log_list.php

示例13: getArticleList

 /**
  * 返回文章列表
  *
  * @return string
  */
 function getArticleList()
 {
     //Sql语句生成
     $this->InitSql();
     $TempString = '';
     $ReturnString = '';
     //文章列表
     //-------------------0---------1------------2---------------3------------4-----------5-----------6------------7-------------8
     $SqlStr = 'SELECT `a`.`id`, `a`.`title`, `a`.`posttime`, `a`.`reurl`, `a`.`html`, `a`.`hits`, `c`.`title`, `a`.`title2`, `a`.`titlecolor`  from `' . DB_TABLE_PRE . 'article` `a`, `' . DB_TABLE_PRE . 'article_cate` `c`';
     $SqlStr .= ' WHERE 1=1';
     $SqlStr .= ' AND `a`.`cateid`=`c`.`id`';
     $SqlStr .= ' AND `a`.`notshowlist` = 0';
     //栏目
     $SqlStr .= $this->SqlCateId;
     //区域
     $SqlStr .= $this->SqlArea;
     //状态
     $SqlStr .= $this->SqlFlag;
     //排序
     $SqlStr .= $this->SqlOrder;
     //显示个数
     $SqlStr .= $this->SqlLimit;
     $this->SqlStr = $SqlStr;
     /*
     echo $SqlStr;
     echo $this->LiClassId;
     */
     $MyDatabase = new Database();
     $MyDatabase->SqlStr = $SqlStr;
     if ($MyDatabase->Query()) {
         $DB_Record_Arr = $MyDatabase->ResultArr;
         foreach ($DB_Record_Arr as $DB_Record) {
             $id = $DB_Record[0];
             $title = subString($DB_Record[1], $this->TitleCount);
             $posttime = $DB_Record[2];
             $reurl = $DB_Record[3];
             $url = $DB_Record[4];
             $hits = $DB_Record[5];
             $catetitle = $DB_Record[6];
             $title2 = $DB_Record[7];
             $titlecolor = $DB_Record[8];
             //如果设置为Title2显示并且存在Title2,则title为title2
             if ($this->ShowTitle2 && $title2 != '') {
                 $title = $title2;
             }
             //跳转链接,如果存在,则文章链接为跳转链接
             if ($reurl != '') {
                 $url = $reurl;
             }
             //文章标题颜色
             if ($titlecolor != '') {
                 $title = '<font color="' . $titlecolor . '">' . $title . '</font>';
             }
             //文章标题是否显示一个Dot
             if ($this->ShowDot) {
                 $title = '·' . $title;
             }
             //产生一个链接
             $TempString = '<a title="' . $DB_Record[1] . '" href="' . $url . '">' . $title . '</a>';
             if ($this->ShowCate) {
                 $TempString = '<span>' . $catetitle . ' | </span>' . $TempString;
             }
             if ($this->ShowHits) {
                 $TempString .= '(' . $hits . ')';
             }
             if ($this->ShowDate) {
                 $TempString .= '<span>' . $posttime . '</span>';
             }
             if ($this->ShowLi) {
                 if ($this->LiClass && $this->LiClassId && $this->LiClassId == $id) {
                     $TempString = '<li class="' . $this->LiClass . '">' . $TempString . '</li>';
                 } else {
                     $TempString = '<li>' . $TempString . '</li>';
                 }
             }
             if ($this->ShowBracket) {
                 $TempString = '[' . $TempString . '] ';
             }
             $ReturnString .= $TempString;
         }
     }
     return $ReturnString;
 }
开发者ID:Zerolone,项目名称:myblog,代码行数:88,代码来源:article.php

示例14: getOrderList

        ?>
    <label for="del<?php 
        echo $tuan['id'];
        ?>
">
    <tr>
      <td><input type="hidden" name="id[]" value="<?php 
        echo $tuan['id'];
        ?>
"><select name="order[]" class="inputbox" id="order[]"><?php 
        echo getOrderList($tuan['order']);
        ?>
</select>
			</td>
      <td>&nbsp;<?php 
        echo subString($tuan['title'], 80);
        ?>
</td>
      <td>&nbsp;<?php 
        echo $tuan['price'];
        ?>
</td>
      <td>&nbsp;<a href="#" onClick="ffClick('tuan/edit.php?tid=<?php 
        echo $tuan['id'];
        ?>
&pagenum=<?php 
        echo $pagenum;
        ?>
','修改:<?php 
        echo $tuan['title'];
        ?>
开发者ID:Zerolone,项目名称:soutuan8,代码行数:31,代码来源:list.php.php

示例15: foreach

echo $title;
?>
</span></h3>
	<ul id="link">
	<?php 
foreach ($link_cache as $value) {
    ?>
	<li style="margin-left: 0px;"><a href="<?php 
    echo $value['url'];
    ?>
" title="<?php 
    echo $value['des'];
    ?>
" target="_blank">
	<?php 
    echo subString(strip_tags($value['link']), 0, 12);
    ?>
	</a></li>
	<?php 
}
?>
	</ul>
	</div>
<?php 
?>
</div>

<div style="height:10px;"></div>

<hr>
开发者ID:Bigstars,项目名称:Wangjx.org,代码行数:30,代码来源:footer.php


注:本文中的subString函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。