drl971115 2018-03-16 20:20
浏览 108

Laravel Undefined调用未定义的函数iconv_strlen()

guys do you have some answer on this a strange bug ? I moved my project from another server and i configured all but i watching some bug Laravel give me a this error :

FatalErrorException in /public_html/app/Http/Controllers/GameController.php line 718:
Call to undefined function App\Http\Controllers\iconv_strlen()

In this code:

 public function DepositRedirect()
{
    if(Auth::guest()) return 'You must be authorized!';
    if(!$this->user->trade) return 'You must set trade list in your profile!';
    $bot = DB::table('bots')->first();
    if(is_null($bot)) return "Bot not found!";
    if(iconv_strlen($bot->trade) < 1) return "Admin hasn't set trade link with bot.";
    return redirect($bot->trade);
}

Why ? This is standart php function for returns the character count of string i use php 7.X

  • 写回答

3条回答 默认 最新

  • dongpu9852 2018-03-16 20:25
    关注

    I would suggest you use

     if(empty($bot->trade) || iconv_strlen($bot->trade) < 1)
    

    This will skip the second statement if the first is true

    评论

报告相同问题?