我正在使用 CakePHP 3.4
我有一个 shell 脚本作为 cron 运行并向用户发送电子邮件,电子邮件包含返回到指定控制器的网站的链接。
为了实现这一点,我Router::url()
在 Shell 中使用来生成基本 url,因为Html->link
在那里不工作
$fullBaseUrl = Router::url('/', true);
$scan_result_url = Router::url(['controller' => 'Notifications', 'action' => 'notificationRedirect', $notification->id], true);
但这是以 localhost 作为主机生成 url
http://localhost/notifications/notification-redirect/<id>
测试时控制器中的同一行给出 url
http://mywebsite.com/notifications/notification-redirect/<id>
如何在 Shell 中获取完整的 url。我的网站托管在服务器上并mywebsite.com
用于访问它?