我想找到一种方法来使它可以检查您当前的页面url是否包含像1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
这样的问题,问题是这种格式可能会永远在任何随机我需要这样做才能让其中一个数字不显示。检查当前页面网址是否包含某些词
目前我正在使用这样的系统来收集当前页面的URL。
$d = explode('?', $_SERVER['REQUEST_URI'], 2);
echo 'http://' . $_SERVER['HTTP_HOST'] . $d[0];
但是我很陌生,我们可以简单地检查某些部分的URL,然后将其重定向回索引页。
编辑:这是我目前的代码(注意我正在使用laravel)。
if (strpos($d, '19') !== false) {
header('Location: http://example.com') ;
} else { ?>
<form class="form-horizontal" role="form" method="POST">
{{ csrf_field() }}
@if(strlen($link->password))
<p class="bg-warning" style="padding: 8px;">Enter password to continue</p>
<input type="password" name="password" class="form-control" style="margin-bottom:1.5rem;">
@endif
<button type="submit" class="btn btn-primary">{{ $link->text }}</button>
</form>
<?php } ?>
很抱歉的乱码,只是想弄清楚我怎么能做到这一点,而无需大量strpos
反倒它现在回声出的形式,它没有。
您的意思是:example.com/index.php?something=1,2,3,4,5 ... **或** example.com/index.php?1,2,3 ,4,5 ... **或** example.com/index.php?something=1&something2=2&something3=3&something2=4&something5=5 ... – Neil
这将是这样的 - > xample.com/index.php ?id = 1然后另一个网址是xample.com/index.php?id=2 – Wayward