相关疑难解决方法(0)

什么是?:在PHP 5.3中?

可能重复: 什么是PHP运算符"?"和":"被调用,它们做了什么?

来自http://twitto.org/

<?PHP
    require __DIR__.'/c.php';
    if (!is_callable($c = @$_GET['c'] ?: function() { echo 'Woah!'; }))
        throw new Exception('Error');
    $c();
?>
Run Code Online (Sandbox Code Playgroud)

Twitto使用从PHP 5.3开始提供的几个新功能:

  1. DIR不变
  2. 运营商
  3. 匿名功能

  1. 在PHP 5.3 中,数字2对?:做什么?

  2. 另外,匿名函数是什么意思?那不是已经存在了一段时间的东西吗?

php ternary-operator language-construct conditional-operator php-5.3

83
推荐指数
3
解决办法
4万
查看次数