Khung máy chủ đặt phòng cho PHP
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Đây là cách triển khai tham khảo của Máy chủ đặt phòng API v3 dựa trên PHP
Điều kiện tiên quyết
Yêu cầu cài đặt
Bắt đầu
Máy chủ đặt phòng được triển khai bằng PHP và Apache. Để định tuyến đúng cách các yêu cầu, tệp này sử dụng tệp.htaccess, vì vậy, hãy đảm bảo rằng bạn đã bật AllowOverride cho thư mục.
Bạn phải thiết lập chứng chỉ SSL và phân phát tất cả yêu cầu qua HTTPS.
Nếu máy chủ của bạn chưa thiết lập chứng chỉ SSL, bạn có thể xem lại tài liệu về SSL/TLS của Apache.
Việc triển khai PHP không dựa vào thư viện vùng đệm giao thức, mà thay vào đó, dựa vào các phương thức chuyển đổi tuần tự JSON đơn giản.
Để tải dự án xuống, hãy thực thi lệnh sau:
git clone https://maps-booking.googlesource.com/php-maps-booking-rest-server-v3-skeleton
Toàn bộ cơ sở mã chỉ bao gồm 3 tệp:
- .htaccess hướng dẫn apache định tuyến tất cả các yêu cầu /v3/ thông qua
bookingserver.php
- bookingserver.php xử lý logic yêu cầu, bao gồm cả xác thực
- apiv3methods.php có các phương thức triển khai giao diện API v3
Sau khi tải các tệp xuống, bạn nên đặt các tệp đó vào một thư mục có thể phân phát.
Xin lưu ý rằng bất kỳ thư mục nào bạn đặt các tệp này vào sẽ trở thành thư mục mẹ của thư mục /v3/ mà bạn không cần tạo một cách rõ ràng.
Kiểm thử Máy chủ đặt phòng
Bạn có thể tải xuống và chạy
tiện ích kiểm thử đặt phòng. Để cài đặt, hãy làm theo hướng dẫn cài đặt được cung cấp trong trang README.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eThis is a PHP-based reference implementation of the API v3 Booking Server, requiring Apache and PHP for setup.\u003c/p\u003e\n"],["\u003cp\u003eIt utilizes a \u003ccode\u003e.htaccess\u003c/code\u003e file for request routing and necessitates an SSL certificate for secure HTTPS communication.\u003c/p\u003e\n"],["\u003cp\u003eThe implementation employs JSON serialization instead of protocol buffer libraries and can be downloaded via a provided \u003ccode\u003egit clone\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eThe code base comprises three primary files: \u003ccode\u003e.htaccess\u003c/code\u003e, \u003ccode\u003ebookingserver.php\u003c/code\u003e, and \u003ccode\u003eapiv3methods.php\u003c/code\u003e, which handle routing, request logic, and API v3 interface methods, respectively.\u003c/p\u003e\n"],["\u003cp\u003eTesting can be conducted using the booking test utility, available for download and installation with instructions in its README.\u003c/p\u003e\n"]]],["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"],null,["# Booking Server Skeleton for PHP\n\nThis is a reference implementation of\n[API v3 Booking Server](/actions-center/verticals/reservations/waitlists/integration-steps/implement-booking-server) based on PHP\n\nPrerequisites\n-------------\n\nRequires an installation of\n\n- [Apache](https://httpd.apache.org/)\n- [PHP](https://secure.php.net)\n\nGetting Started\n---------------\n\nThe Booking Server is implemented using PHP and Apache. To properly route\nthe requests, it makes use of the\n[.htaccess file](https://httpd.apache.org/docs/current/howto/htaccess.html), so make sure that\n[AllowOverride](https://httpd.apache.org/docs/current/mod/core.html#allowoverride) is enabled for the directory.\n\nYou must set up a SSL certificate, and have all requests served over HTTPS.\nIf your server does not already have an SSL certificate setup, you can\nreview the\n[Apache SSL/TLS documentation](https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html).\n\nThe PHP implementation does not rely upon protocol buffer libraries, but\ninstead, relies on simple JSON serialization methods.\n\nTo download the project, execute the following command: \n\n```php\ngit clone https://maps-booking.googlesource.com/php-maps-booking-rest-server-v3-skeleton\n```\n\nThe entire code base consists of only three files:\n\n- .htaccess instructs apache to route all of the /v3/ requests through bookingserver.php\n- bookingserver.php handles the request logic, including authentication\n- apiv3methods.php has the methods implementing API v3 interface\n\nAfter you download the files, you should place them in a servable directory.\nNote that whichever directory you put them in will become the parent to the\n/v3/ directory, which you do not need to explicitly create.\n\nTesting your Booking Server\n---------------------------\n\nYou may download and run the [booking test utility](https://maps-booking.googlesource.com/maps-booking-v3/). To install it, follow the provided installation instructions in its README page.\n\n\u003cbr /\u003e"]]