读书人

三目运算求编译成if语句。该如何处理

发布时间: 2012-05-16 11:12:12 作者: rapoo

三目运算求编译成if语句。。。
还有红色的-号那是个什么概念?

$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';



[解决办法]
substr 函数的第2个参数 翻翻手册吧. 从哪里开始截取
[解决办法]

探讨
还有红色的-号那是个什么概念?

$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

[解决办法]
PHP code
if($ckey_length ){    if ($operation == 'DECODE') {        $keyc=substr($string, 0, $ckey_length);    }else{        $keyc=substr(md5(microtime()), -$ckey_length);    }}else{    $keyc='';} 

读书人网 >PHP

热点推荐