参考文章:http://t.csdn.cn/9KgS1
session原理: https://www.cnblogs.com/lisqiong/p/10172780.html
因为毕设,重新捡起 php,开始敲代码。
先用bitnami的stack安装moodle,一键架服务器和数据库,非常方便,在阿里云上linux版本装的moodle 3.10.0,在本地装的4.0.0。
moodle用的是php语言,目前没找到dialogflow和php的官方api,还好有万能的github,看了半天总算是把dialogflow搞定,能回复纯文字信息即可。
<?php
// This file is part of the Local Chatbot Dialogflow plugin
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This plugin verify group user ldap and create
* cohort same name specified settings
*
* @package local
* @copyright 20XX 开发者姓名 邮箱
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/** @var plugin $plugin */
$plugin->version = 2022100400;//版本号
// moodle version
//$plugin->requires = 2013051400;
$plugin->release = '0.1.0';//版本号
$plugin->maturity = MATURITY_ALPHA;
$plugin->component = 'local_message';//插件类_名称
<?php
//上述的文件头略
function local_message_before_footer() {
\core\notification::add("test Message", \core\output\notification::NOTIFY_INFO);
// redirect('../../index.php', 'Message on redirect', null, \core\output\notification::NOTIFY_SUCCESS);
// die('hello');//这条代码可以在首页上直接打印hello
}
ytb上有PHP开发合集,虽然是5年前的,但是还是依然好用。
Webhook: PHP | Part - 8 | Create Chatbots using Dialogflow(API.AI) & deploy on GCloud
https://www.youtube.com/watch?v=mMtd-Fmr2to&list=PLZmfj7vJb0aFv-JQwSXh1VPAnKkOadhlX&index=20&t=14s
待更新