permitted_uri_chars and $_GET |
[eluser]ooskar[/eluser]
hi, i have CI with default config. my question is: how can i use url like this http://www.mysite/controller/action/?val=1&val=2 now i see error "page not found"
[eluser]Edemilson Lima[/eluser]
You can use segments or query strings, but not both, I think. To enable query strings, open your config/config.php and change this line to TRUE: Code: $config['enable_query_strings'] = FALSE; Code: www.yoursite.com/index.php?c=controler_name&m=function_name&other_var=value
[eluser]ooskar[/eluser]
but i need use standard controller and $_GET together. this http://www.mysite/controller/action/?val=1&val=2 and now i i add "?val=1" CI say "page not found" i tried add "?" to permitted_uri_chars but it doesnt works $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-?&='; $config['enable_query_strings'] = FALSE;
[eluser]Edemilson Lima[/eluser]
Code: http://www.mysite/controller/action/?val=1&val=2 Code: http://www.mysite/controller/action/1/2 Code: class Test extendes Controller { Value 1 = 123 Value 2 = 456 As I said before, this way is more search engine friendly, more readable and more secure.
[eluser]ooskar[/eluser]
but i need use ?val=1 not as function's params but in javascript i need permit "?" in url i dont use $_GET parameters on my website i cant change js because it is from other company
[eluser]Edemilson Lima[/eluser]
Hmmmm... I don't know if it is possible to use URI segments and query strings together. You could enable the query strings ($config[’enable_query_strings’] = TRUE), but in this case you need to build your URLs as I said (www.yoursite.com/?c=controler_name&m=function_name&par1=value&par2=value). I think the regular expression below is wrong. If you want to alow the hifem "-" in your URI, you must put it in the end of the string. Code: $config[’permitted_uri_chars’] = ‘a-z 0-9~%.:_-?&=’;
[eluser]ooskar[/eluser]
so, how should look $config[’permitted_uri_chars’]? $config[’permitted_uri_chars’] = ‘?&=a-z 0-9~%.:_-’; doesnt work
[eluser]Edemilson Lima[/eluser]
Try this: Code: "a-z 0-9~%.:_\?&=-"
|
Welcome Guest, Not a member yet? Register Sign In |