我一次又一次地尝试测试从localhost发送电子邮件,但我仍然不能.我不知道该怎么办.我尝试搜索找到解决方案,但我找不到一个.我编辑了config/mail.php:
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address …Run Code Online (Sandbox Code Playgroud) 我对 ViewModel 中的协程感到困惑。
我的问题很简单:为什么下面的协程看起来没有阻止 UIThread?(协程运行时UI依然流畅)
我的片段就在这里:
class FragmentSeePaths : Fragment(R.layout.fragment_see_paths),
PathRecyclerAdapter.OnSetPathForWidgetListener {
private val pathViewModel: PathViewModel by activityViewModels()
private lateinit var binding: FragmentSeePathsBinding
private lateinit var listener: OnAddLineRequestListener
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
...
}
private fun observeWidgetPath() {
pathViewModel.getUserWidgetPath().observe(viewLifecycleOwner, Observer {
if (it != null) {
lifecycleScope.launch {
val times = pathViewModel.fetchBusTime(it)
updateUI(it, times)
}
}
})
}
Run Code Online (Sandbox Code Playgroud)
这是使用 fetchBusTime 方法拍摄的 ViewModel:
suspend fun fetchBusTime(path: Path): Pair<List<Time>?, List<Time>?> {
Log.v("fetchBusTimeUI", Thread.currentThread().name) // Main
// Some …Run Code Online (Sandbox Code Playgroud) 当我从数据库启动查询数据时,我不知道应该使用Eloquent或Query Builder的方式.什么是最好的选择?Eloquent写入比Query构建器少,但我无法控制输入字段,而Query构建器写的更多,但我可以自己手动输入字段.我还需要了解更多关于它们的内容吗?