請教各位先進:
我想要在字串中尋找'2020',而'2020'是從另一個網頁傳遞過來的變數
只是很奇怪的是,如果用GET將變數指定給$year是找不到的,但如果直接將'2020' 指定給$year卻又找得到
這是發生什麼問題呢?
先謝謝了
A網頁的變數傳遞
<a href="index.php?year='2020'">首頁</a>
B網頁的接收
$year=$_GET['year'];
//$year='2020';
$mystring = '/video/錄影/2020/20200124/@eaDir/';
$pos1 = stripos($mystring, $year);
if ($pos1 === false) {
echo "The string ".$year." was not found in the string ".$mystring."</br>";}
else {
echo "We found ".$year." in ".$mystring." at position ".$pos1."</br>";
};