开发者

Php _REQUEST variable problem (using smarty template)

开发者 https://www.devze.com 2023-01-14 22:03 出处:网络
My understanding is that _REQUEST consists of the GET, POST and cookie data. I have a _REQUEST variable that is filled up with data using GET ie from the URL. This is where I have a couple of problems

My understanding is that _REQUEST consists of the GET, POST and cookie data. I have a _REQUEST variable that is filled up with data using GET ie from the URL. This is where I have a couple of problems.

I thought that GET data was communicated in the url like:

 www.example.com/empty?g=o&h=s 

so with that url the REQUEST would have _$REQUEST[g]=o and _$REQUEST[h]=s.

NOW HERE IS MY PROBLEM. Putting print_r($_REQUEST) at the top of the php script shows behaviour I do not understand. When the script is run like this: i go to www.example.com/script.php, then on the screen the print REQUEST is empty, however when I go to www.example.com/script/test1/35 then the print_r REQUEST reveals

    Array ( [cat] => test1 [pid] => 35 )

SO HOW DOES THE REQUEST VARIABLE KNOW THAT THE GET DATA IS IN THE URL LIKE THAT? HOW DOES IT KNOW THAT CAT REFERS TO DATA AFTER THE SECOND SLASH AND PID REFERS TO DATA AFTER THIRD SLASH.

Not only that, when I make a copy of the script and give it开发者_StackOverflow中文版 a different name so the above example turns into: www.dummy.com/script/test1/35, print_r the REQUEST is empty.

Important note: ALl of the above happens when I put print_r($_REQUEST); as the very first line of the php. I am using smarty php templates. There is a corresponding script.tpl to go with script.php but it contains nothing that specifies a GET structure.

So I am very stuck. Any ideas gratefully received? Once I understand this last part I can finish the project.


Check your .htaccess content .

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号