本文整理匯總了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 }";
}
示例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}');}";
}
示例3: setObject
private function setObject(&$_object)
{
if ($_object) {
Tool::subStr($_object, 'title', 14, 'utf-8');
Tool::objDate($_object, 'date');
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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>');
}
}
示例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>');
}
}
示例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);
}