Home >Backend Development >PHP Tutorial >typecho如何判断tags标签?

typecho如何判断tags标签?

WBOY
WBOYOriginal
2016-06-06 20:35:541492browse

为什么这句无效?:
<?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) ): ?> 判断

Statement:
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