• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP subString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: widget_links

function widget_links()
{
    ?>
<div class="widget">
    <h3>网站收藏</h3>
    <ul>
        <?php 
    $links = Link_Model::getInstance()->getLinks(5);
    foreach ($links as $link) {
        $name = subString($link['link_name'], 0, 16);
        echo "<li><a class='link_description' href='{$link['link_url']}'>{$name}<span>{$link['link_description']}</span></a></li>";
    }
    ?>
    </ul>
</div>
<?php 
}
开发者ID:bekoys,项目名称:blog,代码行数:17,代码来源:module.php


示例17: widget_hotlog

function widget_hotlog($title)
{
    $index_hotlognum = Option::get('index_hotlognum');
    $Log_Model = new Log_Model();
    $randLogs = $Log_Model->getHotLog($index_hotlognum);
    $row['content'] = strip_tags($row['content']);
    ?>

	<?php 
    foreach ($randLogs as $value) {
        ?>
	<div class="random_text_log">
	<a href="<?php 
        echo Url::log($value['gid']);
        ?>
">
	<h3>
	<i class="fa fa-quote-left"></i>
	<?php 
        echo mb_substr($value['title'], 0, 12, 'utf-8');
        ?>
	</h3>
	<?php 
        echo subString(strip_tags($value['log_description']), 0, 30);
        ?>
	</a>
									</div>
	<?php 
    }
    ?>

<?php 
}
开发者ID:hellohy,项目名称:enduring-heart,代码行数:33,代码来源:module.php


示例18: subString

    ?>
<span style="dipslay:none;font-size:9px;color:<?php 
    echo $arrNdayColor[$i * 7 + 5];
    ?>
" title="<?php 
    echo $arrNdayShow[$i * 7 + 5];
    ?>
"><br /><?php 
    echo subString($arrNdayShow[$i * 7 + 5], 0, 2);
    ?>
</span></a></li>
			<li class="DayA"><a<?php 
    echo $arrLogsUrl[$i * 7 + 6] . $arrClass[$i * 7 + 6] . $arrLogsTitle[$i * 7 + 6];
    ?>
><?php 
    echo $arrCurWeek[$i * 7 + 6];
    ?>
<span style="dipslay:none;font-size:9px;color:<?php 
    echo $arrNdayColor[$i * 7 + 6];
    ?>
" title="<?php 
    echo $arrNdayShow[$i * 7 + 6];
    ?>
"><br /><?php 
    echo subString($arrNdayShow[$i * 7 + 6], 0, 2);
    ?>
</span></a></li>
		</ul>
	</div>
<?php 
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:31,代码来源:ncalendar.inc.php


示例19: mc_comment

 /**
  * 最新评论缓存
  */
 private function mc_comment()
 {
     $query = $this->db->query("SELECT option_value,option_name FROM " . DB_PREFIX . "options WHERE option_name IN('index_comnum','comment_subnum','comment_paging','comment_pnum','comment_order')");
     while ($row = $this->db->fetch_array($query)) {
         ${$row}['option_name'] = $row['option_value'];
     }
     $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "comment WHERE hide='n' ORDER BY date DESC LIMIT 0, {$index_comnum}");
     $com_cache = array();
     $com_cids = array();
     while ($show_com = $this->db->fetch_array($query)) {
         $com_page = '';
         if ($comment_paging == 'y') {
             $pid = $show_com['pid'];
             $cid = $show_com['cid'];
             $order = $comment_order == 'newer' ? 'DESC' : '';
             while ($pid != 0) {
                 $show_pid = $this->db->once_fetch_array("SELECT cid,pid FROM " . DB_PREFIX . "comment WHERE cid={$pid}");
                 $pid = $show_pid['pid'];
                 $cid = $show_pid['cid'];
             }
             if (!isset($com_cids[$show_com['gid']])) {
                 $com_cids[$show_com['gid']] = array();
                 $query2 = $this->db->query("SELECT cid FROM " . DB_PREFIX . "comment WHERE gid=" . $show_com['gid'] . " AND pid=0 AND hide='n' ORDER BY date {$order}");
                 while ($show_cid = $this->db->fetch_array($query2)) {
                     $com_cids[$show_com['gid']][] = $show_cid['cid'];
                 }
             }
             $com_page = intval(floor(array_search($cid, $com_cids[$show_com['gid']]) / $comment_pnum)) + 1;
         }
         $com_cache[] = array('cid' => $show_com['cid'], 'gid' => $show_com['gid'], 'name' => htmlspecialchars($show_com['poster']), 'date' => $show_com['date'], 'page' => $com_page, 'mail' => $show_com['mail'], 'content' => htmlClean(subString($show_com['comment'], 0, $comment_subnum), false));
     }
     $cacheData = serialize($com_cache);
     $this->cacheWrite($cacheData, 'comment');
 }
开发者ID:LockGit,项目名称:emlog,代码行数:37,代码来源:cache.php


示例20: recentGbooks_recache

function recentGbooks_recache()
{
    global $DMC, $DMF, $DBPrefix, $strGuestBookHidden;
    if ($DMC == "") {
        $DMC = $DMF;
    }
    $i = 0;
    $result = $DMC->query("select * from " . $DBPrefix . "guestbook order by postTime desc Limit 0,10");
    $contents = "\$recentgbookscache = array(\r\n";
    while ($my = $DMC->fetchArray($result)) {
        $content = str_replace("<br />", "", subString($my['content'], 0, 100));
        if ($my['isSecret']) {
            $content = $strGuestBookHidden;
        }
        $contents .= "\t'" . $i . "' => array(\n\t\t'id' => '" . $my['id'] . "',\n\t\t'content' => '" . $content . "',\n\t\t'author' => '" . $my['author'] . "',\n\t\t'postTime' => '" . $my['postTime'] . "',\n\t\t),\n";
        $i++;
    }
    $contents .= ");";
    writetocache('recentGbooks', $contents);
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:20,代码来源:cache.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sub_str函数代码示例发布时间:2022-05-23
下一篇:
PHP subStr函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap