我尝试在我的 CakePHP 3 网站中使用PHP telegram bot,但遇到了很多问题。
完成
我运行“composer require longman/telegram-bot”并将包复制到“plugins”文件夹。
然后“bin/cake 插件加载 longman/telegram-bot”。
问题
1. 我必须把包裹放在哪里,为什么?供应商或插件
2. 如何在 URL 中调用包方法?
我在“telegram-bot/src/Telegram.php”中添加了“index”方法,并在我的“Template/Users/index.ctp”中尝试了这个片段代码。
echo $this->Html->link('telegram', ['plugin' => 'longman/telegram-bot', 'controller' => 'telegram', 'action' => 'index']);
结果
Error: A route matching "array ( 'plugin' => 'longman/telegram-bot', 'controller' => 'telegram', 'action' => 'index', '_ext' => NULL, )" could not be found.
3. 我必须在“routes.php”中添加什么?
4. 如何在我的控制器和模型中使用“telegram-bot/src/Telegram.php”方法。
5. 还有什么必须遵守的吗?
谢谢。