dongmei9020
2012-03-19 16:28
浏览 35
已采纳

使用Turbo Pascal方式使用PHP获取变量

In Turbo Pascal we have the read(); function. Is there a function to get variables, sent to any script on PHP?

图片转代码服务由CSDN问答提供 功能建议

在Turbo Pascal中,我们有 read(); 函数。 是否有一个函数来获取变量,发送到 PHP 上的任何脚本?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doujiang1001 2012-03-19 16:50
    已采纳

    The Turbo Pascal read() and readln() functions read from file. If no filename is specified, they read from standard input.

    In PHP, you have to open the file first, then read from the file handle allocated on open: the equivalent of standard input in PHP is php://input, so something like:

    $filename = "php://input";
    $handle = fopen($filename, "r");
    $contents = fread($handle, 1024);
    fclose($handle);
    

    But note that it's not particularly practical to do this from a web interface, only from the CLI

    打赏 评论
  • douanrang4728 2012-03-19 16:40

    Are you maybe looking for the eval() function? http://php.net/manual/en/function.eval.php

    打赏 评论

相关推荐 更多相似问题