请教高人:两个php平台之间的数据导入导出
PHP moodle 数据传输
需求:报名招生平台中的学生信息(用户名、密码、姓名、email、选择专业代码)导入到moodle平台数据库中相应的数据表中,
使学生可以在moodle平台中使用用户名和密码登陆moodle系统进行在线学习和参加课程测验,
测验完成后将学生的成绩(用户名、专业代码、课程名称、课程成绩)导出到报名招生平台中,学生可以查看自己的成绩信息。
要求:
这些操作在每天凌晨0点进行自动更新,自动将学生信息和学生成绩导入导出。
现在需要写一个脚本文件,定时执行,请教高人指点,做这个功能的主要步骤,在不同平台不同数据库之间的数据传输应该采用什么过渡保存,数组还是文件?或者是session、cookie?
在线等。。。。。。
回复讨论(解决方案)
没做过,提个思路
数据传输用接口. B平台每天定时执行php文件,请求A平台对应的接口. A平台将新的数据通过接口传给B平台,B平台收到后入库.
用shell脚本应该可以实现的吧。
2个平台能否直接互访问数据库,如果可以的话,直接用shell脚本从a库插入b库就可以了。
如果不能话,那么都需要开发响应的接口
插入数据库放主动拉取数据:
报名招生平台需要提供批量获取用户信息的接口
moodle平台提供批量成绩信息接口
插入数据库被动更新数据:
报名招生平台需要提供批量插入成绩信息的接口
moodle平台提供批量插入用户信息接口
双方通讯可以使用post json 或者 直接下载txt文件
但是上面都是紧紧牵涉的插入,而不牵涉到更新的问题,更新的问题例如
a用户已经在moodle平台中,但是a用户的密码在报名招生平台修改了,那么moodle怎么同步这个密码?
总不能每次都是全部用户更新吧
所以说最好的方式还是报名招生平台提供sso,保持报名招生平台和moodle平台同步登陆登出才是王道。
首先要确定下数据库,如果可以,通过第三方工具。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove
