PHP how to use $_GET with char '&' in it?

时间:2015-05-25 19:06:37

标签: php mysqli

Am trying to use $_GET with char '&' in it since the data in database are categorized using '&' between 2 words, but as storing $_GET in a variable it shows the first word like if:

Stack & Flow => $_GET=Stack

how to fix this without changing the whole database.

Or is there anyway to use 'Start With' in msqli query?

1 个答案:

答案 0 :(得分:1)

HTTP请求方法的基础知识。

GET方法中,您使用URL作为媒介,并使用语法传递数据:

?variable=value&another_variable=value123

其中&是分隔符。你需要对它进行编码。

urlencode('&')