区号查找脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了区号查找脚本相关的知识,希望对你有一定的参考价值。

This simple script will return what state an areacode belongs to. Be sure to get the include file that contains the array here: http://snipplr.com/view/17340/area-code-lookup-script--include-file/
  1. <?php
  2. // ****************************************************** //
  3. // areacode.php -- Areacode Lookup Script //
  4. // //
  5. // Author: Brad Arnold -- http://arnoldb.com //
  6. // //
  7. // Licensed under Creative Commons - Share Alike //
  8. // Licensed under GPL2 //
  9. // //
  10. // This simple script will take an inputted area code //
  11. // and return the state in which the area code belongs. //
  12. // //
  13. // This file must be named areacode.php and the file //
  14. // areacodes.inc.php must reside in the same directory //
  15. // unless changes to the code are made. //
  16. // ****************************************************** //
  17.  
  18. if(!file_exists("areacodes.inc.php")) {
  19. die("ERROR! Areacode Data File is Missing or Corrupt!");
  20. }
  21. else {
  22. require("areacodes.inc.php");
  23. }
  24. ?>
  25.  
  26. <head>
  27. <title>Area Code Lookup Utility</title>
  28. </head>
  29.  
  30. <body>
  31.  
  32. <!-- Begin Form -->
  33. <form action="areacode.php" method="get" onreset="doReset();">
  34. Area Code: <input type="text" name="fareacode" maxlength="3" size="2"/>
  35. <input type="submit" />
  36. <button onclick="form.reset();">Reset</button>
  37. </form>
  38.  
  39. <!-- Begin code -->
  40. <?php
  41. // Put GET data into variable for ease of use
  42. $input = $_GET["fareacode"];
  43.  
  44. // Check the variable, if empty show instructions, if in-use show results
  45. if ($input) {
  46. // If input doesn't match an Area Code in the array return and error
  47. if(empty($areacode[$input])) {
  48. echo "Sorry," . "&nbsp;" . "<a style=font-weight:bold; />" . $input . "</a>" . "&nbsp;" . "is not a valid Area Code.";
  49. }
  50. else echo "Area code" . "&nbsp;" . "<a style=font-weight:bold; />" . $input . "</a>" . "&nbsp;" . "is found in the state of:" . "&nbsp;" . "<a style=font-weight:bold; />" . $areacode[$input] . "</a>";
  51. }
  52. else echo "Enter a three (3) digit Area Code in the box above.";
  53. ?>
  54.  
  55. </body>
  56.  
  57. </html>

以上是关于区号查找脚本的主要内容,如果未能解决你的问题,请参考以下文章

按经纬度查找电话区号

PHP 区号查询脚本

PHP 区号查询脚本 - 包含文件

查询以匹配两个表中具有相同电话号码区号的列

npm : 无法加载文件 D:softcodeProcess ode ode_global pm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.micr +(代码片段

377 是哪个国家的区号