我正在尝试根据表单中的数组生成查询条件,这就是我正在做的事情:
// will this suffice against sql injection?
$filter_type = isset( $_POST['type'] ) ? filter_input( INPUT_POST , 'type', FILTER_SANITIZE_NUMBER_INT , FILTER_REQUIRE_ARRAY ) : NULL;
$type_cond = '';
if ($filter_type != NULL) {
foreach ($filter_type as $type=>$value) {
if ($type === 0) {
// need to add (int) before $value?
$type_cond = "AND t2.type = " . $value;
} else {
$type_cond .= $type_cond . " OR t2.type = " . $value;
}
}
}
使用一个数组索引输出:
AND t2.type = 1
使用两个数组索引输出:
AND t2.type = 1AND t2.type = 1 OR t2.type = 2
使用三个数组索引输出:
AND t2.type = 1AND t2.type = 1 OR t2.type = 2AND t2.type = 1AND t2.type = 1 OR t2.type = 2 OR t2.type = 3
为什么要连续重复?
答案 0 :(得分:2)
因为:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
会将let url = "http://yourserver.com/source.mp3"
let playerItem = AVPlayerItem(URL:NSURL(string:url)!)
audio = AVPlayer(playerItem:playerItem)
audio.rate = 1.0;
audio.play()
添加到$a .= $b;
的当前内容中。因此,如果你这样写:
$b
会将$a
的内容添加到$a .= $a . $b
(因此重复),然后添加$a
的内容。
所以你需要替换它:
$a
用这个:
$b