Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
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/ 目錄的父項,因此您不需要明確建立這個目錄。
測試預訂伺服器
您可以下載並執行
預訂測試公用程式。如要安裝,請按照 README 頁面提供的安裝操作說明進行。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[],["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 implementation utilizes JSON instead of protocol buffers. To get started, clone the project using `git clone`. The codebase includes `.htaccess` for routing, `bookingserver.php` for request handling and authentication, and `apiv3methods.php` for API v3 method implementations, all of which need to be placed in a directory. A separate booking test utility is provided.\n"]]