15-1.php

来自「《php程序设计》的配套源码 《php程序设计》的配套源码 《php程序」· PHP 代码 · 共 19 行

PHP
19
字号
<?php
  function include_remote($filename) {
    $data = implode("\n", file($filename));
    if ($data) {
      $tempfile = tempnam(getenv("TEMP"), "inc");
      $fp = fopen($tempfile, "w");
      fwrite($fp, $data);
      fclose($fp);
      include($tempfile);
      unlink($tempfile);
    }
    echo "<b>ERROR:Unable to include ".$filename."</b><br>\n";
    return FALSE;
  }

  //sample usage
  include_remote("http://www.example.com/stuff.inc");
?>

⌨️ 快捷键说明

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