Home >Backend Development >PHP Tutorial >这句php语句是什么意思?

这句php语句是什么意思?

WBOY
WBOYOriginal
2016-06-23 14:24:241105browse

$space_name = $tmp_user ? $tmp_user : ($username ? $username : $pd_username);


回复讨论(解决方案)

看下php的三元运算符

$space_name = $tmp_user ? $tmp_user : ($username ? $username : $pd_username);

先执行括号里面的三元字符,然后再执行外面的,很简单,
三元字符就是if语句的简写

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
Previous article:网站的网页出现空白问题.Next article:正则匹配