是有可能存在的任何类型的值中$_GET或$_POST它是不阵列或字符串?
对于那些更好地阅读代码的人来说,是否可以在Web服务器上运行这个简单的脚本并让它抛出异常?
// crash-me.php
<?php
function must_be_array_or_string($value) {
if(is_string($value))
return;
if(is_array($value)) {
foreach($value as $subValue)
must_be_array_or_string($subValue);
return;
}
throw new Exception("Value is " . gettype($value));
}
if(isset($_GET))
must_be_array_or_string($_GET);
if(isset($_POST))
must_be_array_or_string($_POST);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
881 次 |
| 最近记录: |