⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zpairporttips.php

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 PHP
字号:
<?php/** * Takes in keyword and sends back list of airports containing this keyword in * the city name or airport name or IATA location identifier. * * Part of Zapatec Travel application. * * Copyright (c) 2004-2006 by Zapatec, Inc. * http://www.zapatec.com * 1700 MLK Way, Berkeley, California, * 94709, U.S.A. * All rights reserved. *//* $Id: zpairporttips.php 7323 2007-06-01 21:05:51Z alex $ */// JSON converterrequire_once('JSON.php');$objJsonConverter = new Services_JSON();// Include IATA location identifiersrequire_once('zpairports.php');// Will hold result$arrResult = array();// Get keyword$strKeyword = isset($_GET['q']) ? strtoupper($_GET['q']) : '';// Keyword must contain at least 3 chars, otherwise result will not be preciseif (strlen($strKeyword) > 2) {	// Search by IATA location identifier	if (isset($ZP_AIRPORTS[$strKeyword])) {		// Match		array_push($arrResult, array(			'code' => $strKeyword,			'city' => $ZP_AIRPORTS[$strKeyword]['city'],			'name' => $ZP_AIRPORTS[$strKeyword]['name']		));	}	// Search by city and name	foreach ($ZP_AIRPORTS as $strKey => $objValue) {		if ((preg_match("/^$strKeyword/i", $objValue['city']) ||		 preg_match("/^$strKeyword/i", $objValue['name'])) &&		 $strKey != $strKeyword) {			// Match			array_push($arrResult, array(				'code' => $strKey,				'city' => $objValue['city'],				'name' => $objValue['name']			));		}	}}// Return resultecho $objJsonConverter->encode(array('tips' => $arrResult));?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -