PHP 版预订服务器框架
这是基于 PHP 的 API v3 预订服务器参考实现
前提条件
需要安装
使用入门
预订服务器使用 PHP 和 Apache 实现。为了正确路由请求,它会使用 .htaccess 文件,因此请确保为该目录启用 AllowOverride。
您必须设置 SSL 证书,并通过 HTTPS 提供所有请求。
如果您的服务器尚未设置 SSL 证书,您可以查看 Apache SSL/TLS 文档。
PHP 实现不依赖于协议缓冲区库,而是依赖于简单的 JSON 序列化方法。
如需下载该项目,请执行以下命令:
git clone https://maps-booking.googlesource.com/php-maps-booking-rest-server-v3-skeleton
整个代码库仅包含三个文件:
- .htaccess 指示 Apache 通过 bookingserver.php 路由所有 /v3/ 请求
- bookingserver.php 处理请求逻辑,包括身份验证
- apiv3methods.php 包含实现 API v3 接口的方法
下载文件后,您应将其放入可供服务的目录中。
请注意,无论您将它们放在哪个目录中,该目录都将成为 /v3/ 目录的父目录,而您无需显式创建该目录。
测试预订服务器
您可以下载并运行
预订测试实用程序。如需安装该插件,请按照其自述文件页面中提供的安装说明操作。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-26。
[null,null,["最后更新时间 (UTC):2024-11-26。"],[[["This is a PHP-based reference implementation of the API v3 Booking Server, requiring Apache and PHP for setup."],["It utilizes a `.htaccess` file for request routing and necessitates an SSL certificate for secure HTTPS communication."],["The implementation employs JSON serialization instead of protocol buffer libraries and can be downloaded via a provided `git clone` command."],["The code base comprises three primary files: `.htaccess`, `bookingserver.php`, and `apiv3methods.php`, which handle routing, request logic, and API v3 interface methods, respectively."],["Testing can be conducted using the booking test utility, available for download and installation with instructions in its README."]]],["This PHP-based reference implementation of the API v3 Booking Server requires Apache and PHP. It uses `.htaccess` for request routing, necessitating `AllowOverride` and HTTPS with an SSL certificate. The server utilizes JSON for data serialization instead of protocol buffers. Installation involves cloning the project via `git` into a servable directory. The code consists of `.htaccess`, `bookingserver.php` for request logic and authentication, and `apiv3methods.php` for API methods implementation. A separate booking test utility is available for server testing.\n"]]