Web*_*ots 8 apache xampp perl wamp
我是Perl语言的新手,我尝试像运行PHP文件一样运行它,方法是将文件放在htdocs中,然后通过localhost访问它们.
下面是我创建的Perl文件,但无法在localhost上运行:
----- hello.pl ---------------
#!/usr/bin/perl
print "Hello World.\n";
Run Code Online (Sandbox Code Playgroud)
Din*_*tra 15
你好世界节目:
#!C:\xampp\perl\bin\perl.exe
# The above line is perl execution path in xampp
# The below line tells the browser, that this script will send html content.
# If you miss this line then it will show "malformed header from script" error.
print "Content-type: text/html\n\n";
print "Hello world."
Run Code Online (Sandbox Code Playgroud)
现在从xampp控制面板启动apache.在浏览器的url中,输入localhost/perl/hello.cgi.
如果您的 PHP 安装有 Perl 模块,您可以直接从 PHP 评估 Perl 代码。
<?php
print "Hello from PHP!";
$perl = new Perl();
$perl->require("test1.pl");
print "Bye!";
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
32615 次 |
| 最近记录: |