【发布时间】:2016-12-25 23:18:01
【问题描述】:
我怎么能这么快写出来?
$abc = file_get_contents('one.txt');
if($abc !== '')
{
msg($abc);
} else {
msg('nope');
}
我试过了:
$abc = file_get_contents('one.txt');
if($abc !== '') ? msg($abc) : msg('nope');
或
$abc = file_get_contents('one.txt');
msg if($abc !== '') ? $abc : 'nope';
不工作,请帮忙!
【问题讨论】:
标签: php conditional-operator shorthand