2011-05-18 69 views
2

研究員的代碼,我有一個codeigniter控制器中的函數,它接受幾個參數之一,其中一個是電子郵件地址。在我的CI配置電子郵件@ gmail_com週期轉換爲下劃線

我已經允許時期和 '@':它被稱爲人喜歡:

domain/path/mycontroller/myfunc/[email protected]/anotherparam 

什麼控制器已是

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\[email protected]'; 

和我。 htaccess是以下內容:

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] 

有關如何我可以解決這個問題的任何想法?

感謝

回答

0

發現了CI論壇上相關的帖子,從2008年:

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

貌似有些人具有完全相同的問題,並調整在config.php$config['uri_protocol']是解決辦法。

/* 
|-------------------------------------------------------------------------- 
| 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"; 

至少有一個人報告說QUERY_STRING值解決了他們的問題。如果這不起作用,請嘗試其他美味的口味設置。

希望這可以幫助您找到解決方案的正確途徑。

+0

嘿韋斯利,看起來像REQUEST_URI做的伎倆。我稍後會做更多的測試,以確保這個改變沒有破壞其他任何東西,但它看起來很有前途:)非常感謝。我很欣賞快速反應。 – djeetee 2011-05-18 17:49:52

0

你可以只在基地64加密的電子郵件地址,然後當你要使用它的解密方法:

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

這將爲你想通過URL發送任何文字工作。更安全,並且不限於電子郵件地址。儘管會創建一個更長的URL。