我使用 Angular-7 作为前端和 Laravel-5.8 作为后端在 Windows 操作系统上开发了一个 Web 门户。在部署之前,我在本地机器上测试了一切,一切正常。
Linux Ubuntu 服务器 IP 为:20.10.10.122 Laravel 文件路径为:
http://120.10.10.122/client-app/backend
.env
APP_NAME=Client
APP_ENV=local
APP_KEY=base64:QT/LLNA/aduSekOXF4/CsY1iYEcRwwwwssssssHxuFs=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=http://localhost/
DB_PORT=3306
DB_DATABASE=client
DB_USERNAME=jdggsss
DB_PASSWORD=kjhgfdddd
Run Code Online (Sandbox Code Playgroud)
但是,当我部署到 Linux Ubuntu-18 Server 时,我运行了该应用程序。当用户尝试登录时,我收到此错误:
消息:“SQLSTATE[HY000] [2002] php_network_getaddresses:getaddrinfo 失败:名称解析暂时失败(SQL:select * from
userswhereactive= 1 anddeleted_atis null andusers.deleted_atis null limit 1)”
为什么我会收到错误消息,我该如何解决?
我正在使用 Angular-7 进行门户网站应用程序。我有一个材质日期选择器,我只想从中获取没有时间戳的日期。它还应该采用以下格式:dd/mm/yyyy
这是它在前端的显示方式:
<div class="col-xs-6">
<label for="loading_date">Loading Date</label>
<div class="input-group date">
<mat-form-field>
<input matInput [matDatepicker] = "picker" placeholder = "Choose a date" name="loading_date" [(ngModel)]="quoteModel.loading_date" #loading_date="ngModel" [ngClass]="{'is-invalid' : loading_date.invalid && ((loading_date.dirty || loading_date.touched) || quoteform.submitted)}" required>
<mat-datepicker-toggle matSuffix [for] = "picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<div class="form-feedback" *ngIf="loading_date.invalid && ((loading_date.dirty || loading_date.touched) || quoteform.submitted)">
<div style="color:red;" *ngIf="loading_date.errors?.required"class="alert alert-danger">Loading Date is required.</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
当我提交到数据库时,我想得到以下格式的结果:
2019-09-26
但这就是我得到的:
2019-09-26T23:00:00.000Z
我该如何实现这一目标?