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


PHP Tool::subStr方法代码示例

本文整理汇总了PHP中Tool::subStr方法的典型用法代码示例。如果您正苦于以下问题:PHP Tool::subStr方法的具体用法?PHP Tool::subStr怎么用?PHP Tool::subStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tool的用法示例。


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

示例1: index

 public function index()
 {
     $_cookie = new Cookie('user');
     $_user = $_cookie->getCookie();
     $_cookie = new Cookie('face');
     $_face = $_cookie->getCookie();
     if ($_user && $_face) {
         $_member .= '<h2>会员信息</h2>';
         $_member .= '<div class="a">您好,<strong>' . Tool::subStr($_user, null, 8, 'utf-8') . '</strong> 欢迎光临</div>';
         $_member .= '<div class="b">';
         $_member .= '<img src="images/' . $_face . '" alt="' . $_user . '" />';
         $_member .= '<a href="###">个人中心</a>';
         $_member .= '<a href="###">我的评论</a>';
         $_member .= '<a href="register.php?action=logout">退出登录</a>';
         $_member .= '</div>';
     } else {
         $_member .= '<h2>会员登录</h2>';
         $_member .= '<form method="post" name="login" action="register.php?action=login">';
         $_member .= '<label>用户名:<input type="text" name="user" class="text" /></label>';
         $_member .= '<label>密 码:<input type="password" name="pass" class="text" /></label>';
         $_member .= '<label class="yzm">验证码:<input type="text" name="code" class="text code" /> <img src="config/code.php" onclick=javascript:this.src="config/code.php?tm="+Math.random(); class="code" /></label>';
         $_member .= '<p><input type="submit" name="send" value="登录" onclick="return checkLogin();" class="submit" /> <a href="register.php?action=reg">注册会员</a> <a href="###">忘记密码?</a></p>';
         $_member .= '</form>';
     }
     echo "function getIndexLogin() {\n\t\t\t\tdocument.write('{$_member}');\n\t\t\t  }";
 }
开发者ID:echo-tang,项目名称:XMFreamwork,代码行数:26,代码来源:Cache.class.php

示例2: index

 public function index()
 {
     $_cookie = new Cookie('user');
     $_user = $_cookie->getCookie();
     $_cookie = new Cookie('face');
     $_face = $_cookie->getCookie();
     if ($_user && $_face) {
         $_member .= '<h2>Member Info</h2>';
         $_member .= '<div class="a">Hello, Welcome <strong>' . Tool::subStr($_user, null, 8, null) . '</strong></div>';
         $_member .= '<div class="b">';
         $_member .= '<img src="image/' . $_face . '" />';
         $_member .= '<a href="###">Personal</a>';
         $_member .= '<a href="###">My Comment</a>';
         $_member .= '<a href="register.php?action=logout">Logout</a>';
         $_member .= '</div>';
     } else {
         $_member .= '<h2>Member Login</h2>';
         $_member .= '<form method="post" name="login" action="register.php?action=login">';
         $_member .= '<label>Username: <input type="text" name="user" class="text" /></label>';
         $_member .= '<label>Password: <input type="password" name="pass" class="text" /></label>';
         $_member .= '<label class="yzm">Validation: <input type="text" name="code" class="text code" /><img src="config/code.php" onclick=javascript:this.src="config/code.php?tm="+Math.random(); class="code" /></label>';
         $_member .= '<p><input type="submit" name="send" value="login" class="submit" /><a href="register.php?action=reg">Register</a><a href="###">Forgot Password?</a></p>';
         $_member .= '</form>';
     }
     echo "function getIndexLogin() {document.write('{$_member}');}";
 }
开发者ID:e0zhao02,项目名称:sample_code,代码行数:26,代码来源:Cache.class.php

示例3: setObject

 private function setObject(&$_object)
 {
     if ($_object) {
         Tool::subStr($_object, 'title', 14, 'utf-8');
         Tool::objDate($_object, 'date');
     }
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:7,代码来源:ListAction.class.php

示例4: show

 private function show()
 {
     parent::page($this->_model->getLinkTotal());
     $this->_tpl->assign('show', true);
     $this->_tpl->assign('title', '友情链接列表');
     $_object = $this->_model->getAllLink();
     Tool::subStr($_object, 'weburl', 20, 'utf-8');
     Tool::subStr($_object, 'logourl', 20, 'utf-8');
     if ($_object) {
         foreach ($_object as $_value) {
             switch ($_value->type) {
                 case 1:
                     $_value->type = '文字链接';
                     break;
                 case 2:
                     $_value->type = 'Logo链接';
                     break;
             }
             if (empty($_value->state)) {
                 $_value->state = '<span class="red">[未审核]</span> | <a href="link.php?action=state&type=ok&id=' . $_value->id . '">通过</a>';
             } else {
                 $_value->state = '<span class="green">[已通过]</span> | <a href="link.php?action=state&type=cancel&id=' . $_value->id . '">取消</a>';
             }
         }
     }
     $this->_tpl->assign('AllLink', $_object);
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:27,代码来源:LinkAction.class.php

示例5: show

 private function show()
 {
     parent::page($this->_model->getCommentListTotal());
     $this->_tpl->assign('show', true);
     $this->_tpl->assign('title', '评论列表');
     $_object = $this->_model->getCommentList();
     Tool::subStr($_object, 'content', 30, 'utf-8');
     if ($_object) {
         foreach ($_object as $_value) {
             if (empty($_value->state)) {
                 $_value->state = '<span class="red">[未审核]</span> | <a href="comment.php?action=state&type=ok&id=' . $_value->id . '">通过</a>';
             } else {
                 $_value->state = '<span class="green">[已审核]</span> | <a href="comment.php?action=state&type=cancel&id=' . $_value->id . '">取消</a>';
             }
         }
     }
     $this->_tpl->assign('CommentList', $_object);
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:18,代码来源:CommentAction.class.php

示例6: show

 private function show()
 {
     parent::page($this->_model->getRotatainTotal());
     $this->_tpl->assign('show', true);
     $this->_tpl->assign('title', '轮播器列表');
     $_object = $this->_model->getAllRotatain();
     Tool::subStr($_object, 'title', 20, 'utf-8');
     Tool::subStr($_object, 'link', 20, 'utf-8');
     if ($_object) {
         foreach ($_object as $_value) {
             if (empty($_value->state)) {
                 $_value->state = '<span class="red">[否]</span> | <a href="rotatain.php?action=state&type=ok&id=' . $_value->id . '">确定</a>';
             } else {
                 $_value->state = '<span class="green">[是]</span> | <a href="rotatain.php?action=state&type=cancel&id=' . $_value->id . '">取消</a>';
             }
         }
     }
     $this->_tpl->assign('AllRotatain', $_object);
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:19,代码来源:RotatainAction.class.php

示例7: show

 private function show()
 {
     $this->_tpl->assign('show', true);
     $this->_tpl->assign('title', 'Article List');
     $this->nav();
     $_nav = new NavModel();
     if (empty($_GET['nav'])) {
         $_id = $_nav->getAllNavChildId();
         $this->_model->nav = Tool::objArrOfStr($_id, 'id');
     } else {
         $_nav->id = $_GET['nav'];
         if (!$_nav->getOneNav()) {
             Tool::alertBack('nav not existing');
         }
         $this->_model->nav = $_nav->id;
     }
     parent::page($this->_model->getListContentTotal());
     $_object = $this->_model->getListContent();
     Tool::subStr($_object, 'title', 20, null);
     $this->_tpl->assign('SearchContent', $_object);
 }
开发者ID:e0zhao02,项目名称:sample_code,代码行数:21,代码来源:ContentAction.class.php

示例8: searchTag

 private function searchTag()
 {
     if ($_GET['type'] == 3) {
         $this->_model->inputkeyword = $_GET['inputkeyword'];
         parent::page($this->_model->searchTagContentTotal(), ARTICLE_SIZE);
         $_object = $this->_model->searchTagContent();
         Tool::subStr($_object, 'info', 120, 'utf-8');
         Tool::subStr($_object, 'title', 35, 'utf-8');
         if ($_object) {
             foreach ($_object as $_value) {
                 if (empty($_value->thumbnail)) {
                     $_value->thumbnail = 'images/none.jpg';
                 }
             }
         }
         $_tag = new TagModel();
         $_tag->tagname = $this->_model->inputkeyword;
         $_tag->getOneTag() ? $_tag->addTagCount() : $_tag->addTag();
         $this->_tpl->assign('SearchContent', $_object);
     }
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:21,代码来源:SearchAction.class.php

示例9: login

 public function login()
 {
     $_cookie = new Cookie('user');
     $_user = $_cookie->getCookie();
     $_cookie = new Cookie('face');
     $_face = $_cookie->getCookie();
     if ($_user && $_face) {
         $this->_tpl->assign('user', Tool::subStr($_user, null, 8, null));
         $this->_tpl->assign('face', $_face);
     } else {
         $this->_tpl->assign('login', true);
     }
     $this->_tpl->assign('cache', IS_CACHE);
     if (IS_CACHE) {
         $this->_tpl->assign('member', '<script>getIndexLogin();</script>');
     }
 }
开发者ID:e0zhao02,项目名称:sample_code,代码行数:17,代码来源:IndexAction.class.php

示例10: login

 private function login()
 {
     $_cookie = new Cookie('user');
     $_user = $_cookie->getCookie();
     $_cookie = new Cookie('face');
     $_face = $_cookie->getCookie();
     if ($_user && $_face) {
         $this->_tpl->assign('user', Tool::subStr($_user, null, 8, 'utf-8'));
         $this->_tpl->assign('face', $_face);
     } else {
         $this->_tpl->assign('login', true);
     }
     $this->_tpl->assign('cache', IS_CAHCE);
     if (IS_CAHCE) {
         $this->_tpl->assign('member', '<script type="text/javascript">getIndexLogin();</script>');
     }
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:17,代码来源:IndexAction.class.php

示例11: show

 private function show()
 {
     if (empty($_GET['kind'])) {
         $this->_model->kind = '1,2,3';
     } else {
         $this->_model->kind = $_GET['kind'];
     }
     parent::page($this->_model->getAdverTotal());
     $this->_tpl->assign('show', true);
     $this->_tpl->assign('title', '广告列表');
     $_object = $this->_model->getAllAdver();
     Tool::subStr($_object, 'link', 20, 'utf-8');
     if ($_object) {
         foreach ($_object as $_value) {
             switch ($_value->type) {
                 case 1:
                     $_value->type = '文字广告';
                     break;
                 case 2:
                     $_value->type = '头部广告690x80';
                     break;
                 case 3:
                     $_value->type = '侧栏广告270x200';
                     break;
             }
             if (empty($_value->state)) {
                 $_value->state = '<span class="red">[否]</span> | <a href="adver.php?action=state&type=ok&id=' . $_value->id . '">确定</a>';
             } else {
                 $_value->state = '<span class="green">[是]</span> | <a href="adver.php?action=state&type=cancel&id=' . $_value->id . '">取消</a>';
             }
         }
     }
     $this->_tpl->assign('AllAdver', $_object);
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:34,代码来源:AdverAction.class.php


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