typecho如何判断tags标签?

WBOY
Release: 2016-06-06 20:35:54
Original
1465 people have browsed it

为什么这句无效?:
<?php if ($this->tags != 'abc'): ?> //abc是标签的缩略名

反而这句判断分类的却可以?:
<?php if($this->category != 'abc'): ?> //abc是分类的缩略名

我是想从首页中排除含有某一标签的文章,请问该怎么写?求大神指教!谢谢!

回复内容:

为什么这句无效?:
<?php if ($this->tags != 'abc'): ?> //abc是标签的缩略名

反而这句判断分类的却可以?:
<?php if($this->category != 'abc'): ?> //abc是分类的缩略名

我是想从首页中排除含有某一标签的文章,请问该怎么写?求大神指教!谢谢!

分类和标签都是一个数组,最好用 <?php if( in_array('abc', $this->tags) ): ?> 判断

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!