请帮助我,纠正我错的地方.下面是我的代码,当时区是英国它将打印其他部分为什么真的不明白.
$user = User::find(BaseHelper::getCurrentUser());
if($user->timezone ='UK')
{
$date = Carbon::createFromFormat('Y-m-d H:i:s', $this->updated, 'GMT');
$date->timezone("Europe/London");
} else {
$date = Carbon::parse($this->updated)->format('d/m/Y h:i A');
}
Run Code Online (Sandbox Code Playgroud)
if($user->timezone ='UK')当你应该使用时,你在这里使用的是平等的==
=用于分配,==用于比较价值.
if($user->timezone ='UK')
Run Code Online (Sandbox Code Playgroud)
将不会返回true,因为该值已成功存储在变量中.
| 归档时间: |
|
| 查看次数: |
345 次 |
| 最近记录: |