不允许Perl加载本地资源
我想做的是把它写入一个文本文件。但当我单击“提交”按钮时,控制台显示错误:不允许加载本地资源:file:///C:/xampp/cgi-bin/test.pl不允许Perl加载本地资源,perl,Perl,我想做的是把它写入一个文本文件。但当我单击“提交”按钮时,控制台显示错误:不允许加载本地资源:file:///C:/xampp/cgi-bin/test.pl #!"C:\xampp\perl\bin\perl.exe" use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); my $cgi = CGI->new; print $cgi->header, $cgi->start
#!"C:\xampp\perl\bin\perl.exe"
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new;
print $cgi->header,
$cgi->start_html,
$cgi->start_form(-action=>'C:\xampp\cgi-bin\test.pl'),
$cgi->textfield(-name=>'myString'),
$cgi->submit,
$cgi->end_form,
$cgi->end_html;
test.pl
#!"C:\xampp\perl\bin\perl.exe"
# print "Content-type: text/html; charset=iso-8859-1\n\n";
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new;
my $string = $cgi->param("myString");
print $cgi->header,
$cgi->start_html('Writing to a file');
open my $fh, '>', './write.txt' or die "failed to open './write.txt' $!";
print $fh $string;
close $fh;
print $cgi->p( "qq(write.txt should contain ".$string.") ");
print $cgi->end_html;
有什么问题吗?test.pl是“C:\xampp\cgi-bin\test.pl”
$cgi->start\u form(-action=>'C:\xampp\cgi-bin\test.pl'),
您需要通过web服务器访问脚本。您必须提供一个HTTP URL
$cgi->start\u form(-action=>'C:\xampp\cgi-bin\test.pl'),
您需要通过web服务器访问脚本。您必须提供一个HTTP URL