Heim >Backend-Entwicklung >PHP-Tutorial >在再简化代码需求~~
$x = md5($row['userid']."+".$row['pwd']);$str = base64_encode($row['userid'].".".$x);//print_r($str);die;$b=explode("/",DEDEROOT);$c=$b['1'];$a ='/reg/resetpw.php?p='.$str;$a = "<a href='$a'>$c.$a</a>";
如果你的php版本在5.4及5.4以上的话,你的这段代码
$b=explode("/",DEDEROOT);
$c=$b['1'];
可以简化为
$c=explode("/",DEDEROOT)[1];
list($b,$c,$d)=explode("/",DEDEROOT);$a ='/reg/resetpw.php?p='.base64_encode($row['userid'].".".md5($row['userid']."+".$row['pwd']));$a = "<a href='$a'>$c.$a</a>";
如果你的php版本在5.4及5.4以上的话,你的这段代码
$b=explode("/",DEDEROOT);
$c=$b['1'];
可以简化为
$c=explode("/",DEDEROOT)[1];
饿 php版本没有达到要求。
没别的办法?
list($b,$c,$d)=explode("/",DEDEROOT);$a ='/reg/resetpw.php?p='.base64_encode($row['userid'].".".md5($row['userid']."+".$row['pwd']));$a = "<a href='$a'>$c.$a</a>";
$x = md5($row['userid']."+".$row['pwd']);$str = base64_encode($row['userid'].".".$x);$b=explode("/",DEDEROOT);$a ='/reg/resetpw.php?p='.$str;$a = "<a href='".$a."'>".$b[1].$a."</a>";
$x = md5($row['userid']."+".$row['pwd']);$str = base64_encode($row['userid'].".".$x);$b=explode("/",DEDEROOT);$a ='/reg/resetpw.php?p='.$str;$a = "<a href='".$a."'>".$b[1].$a."</a>";
$x = md5($row['userid']."+".$row['pwd']);$str = base64_encode($row['userid'].".".$x);$b=explode("/",DEDEROOT);$a ='/reg/resetpw.php?p='.$str;$a = "<a href='".$a."'>".$b[1].$a."</a>";
$x = md5($row['userid']."+".$row['pwd']);$str = base64_encode($row['userid'].".".$x);$b=explode("/",DEDEROOT);$a ='/reg/resetpw.php?p='.$str;$a = "<a href='".$a."'>".$b[1].$a."</a>";
不要太过于简化,因为那会导致PHP 版本兼容性??
???量就少了
$x = md5($row['userid']."+".$row['pwd']);$x = base64_encode($row['userid'].".".$x);//print_r($x);die;$b=explode("/",DEDEROOT);$b = "<a href='/reg/resetpw.php?p={$x}'>{$b['1']}./reg/resetpw.php?p={$x}</a>";echo '<pre class="brush:php;toolbar:false">',var_dump($b),'';
strtok(DEDEROOT, "/");$a ='/reg/resetpw.php?p=' . base64_encode($row['userid'].".".md5($row['userid']."+".$row['pwd']));$a = "<a href='$a'>".strtok("/")."$a</a>";