开发者

Case sensitive , add strtolower [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Users to register only lower case letters

Hi, I have this register page , and i would like to have the script register only lower case letters : pretty I do not want it to register :Pretty , PRETTy , PRETTY ... Here is the code , what do i need to add to it ?

public f开发者_StackOverflow中文版unction addField($field_name){

    if (!array_key_exists($field_name, $this->fields))
    {
        if ($field_name=='username') {
            $field = new field_join_username();
            parent::registerField($field);
        }

        if ($field_name=='email') {
            $field = new field_join_email();
            parent::registerField($field);
        }
    }

    parent::addField($field_name);
}


Where's that code taken from? Are you trying to change existing code?

As far as I can see, this only adds fields not values of fields where the strtolower should be applied, so applying strtolower to field_name won't do the trick ... but it's hard to guess where to place strtolower without seeing the correct code snippet.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜