简体   繁体   English

函数标题($ _ GET [“page”])总是返回空字符串

[英]function title($_GET[“page”]) always returning empty string

This doesn't seem to work correctly for me, it always returns an empty string. 这对我来说似乎不正常,它总是返回一个空字符串。 I could not find the error that I made. 我找不到我犯的错误。

function title($page){
    $i=0;
    $title="";
    foreach ($page as $c){
        if ($i===0){
            ucfirst($c);
        }
        if ($c=="_"){
            $c=" ";
        }
        $i++;
        array_push($title,$c);
    }
    return $title;
}

Try 尝试

function title($page)
{
  return ucfirst(str_replace('_', ' ', $page));
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM