<?php
include('conn.php');
$student_id = $_SESSION['student_id'];
$college_name = $_GET['college_name'];
$college_name22 = explode('(', $college_name);
if(preg_match('#\((.*?)\)#', $college_name, $match))
{
$match[1] = lcfirst($match[1]);
}
else
{
$match[1] = 'All';
}
>
如果URL有串狀
cstest/view.php?college_name=Agra%20Public%20Institute%20of%20Technology%20&%20Computer%20Education,%20Artoni%20(Pharmacy)
,我想爆炸以下字符串即
Agra%20Public%20Institute%20of%20Technology%20&%20Computer%20Education,%20Artoni%20(Pharmacy)
當我回聲$ college_name?它只顯示(阿格拉公共技術學院)未滿(即Agra Public Institute of Technology & Computer Education,Artoni)和$ match [1]包含(藥房),當我打印$ match [1]時顯示'All'。那麼,我該如何解決這個問題呢?
謝謝
'var_dump($ _ GET)'看起來像什麼?對於初學者來說,它不會包含URL編碼的字符串。如果你訪問的URL是''''和'(',你的瀏覽器有問題,它們也會被編碼爲%2C和%28) – miken32