开发者

periods converted to underscores

Fellow coders, i have a function in a codeigniter controller that accepts a couple of parameters one of them being an email address. it is called liked this:

domain/path/mycontroller/myfunc/email@gmail.com/anotherparam  

what the controller is receiving is: email@gmail_com

i have allowed periods and '@' in my CI config:

$conf开发者_运维问答ig['permitted_uri_chars'] = 'a-z 0-9~%.:_\-@';  

and my .htaccess is the following:

RewriteEngine On
RewriteBase /myapp/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /myapp/index.php?/$1 [L]

Any thoughts on how i can solve this problem?

thanks


Found a related post on the CI forum from 2008:

http://codeigniter.com/forums/viewthread/94091/

Looks like some people were having the exact same problem, and tweaking the $config['uri_protocol'] in config.php was the solution.

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of "AUTO" works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'            Default - auto detects
| 'PATH_INFO'        Uses the PATH_INFO
| 'QUERY_STRING'    Uses the QUERY_STRING
| 'REQUEST_URI'        Uses the REQUEST_URI
| 'ORIG_PATH_INFO'    Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol']    = "QUERY_STRING";

At least one person reported that the QUERY_STRING value fixed their problem. If this doesn't work, try one of the other delicious flavors settings.

Hope this gets you on the right path to a solution.


You could just encrypt the email address in Base 64 and then unencrypt when you want to use it:

base64_encode($email_address);
base64_decode($url_segment);

This will work for any text you want to send over the URL. Safer, and not limited to email addresses. Will create a longer URL though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜