看板 Perl 關於我們 聯絡資訊
#!/usr/local/bin/perl use lib "$home/xxx"; use CGI; use strict; use Template; my $q=new CGI; print $q->header(-charset => 'utf-8'); print $q->start_html("hello"); my $config= { INCLUDE_PATH => ".", eval_perl =>1, }; my $template=Template->new($config); my $replace="Hello你好阿!!"; my $vars= { var =>$replace, }; my $temp_file="template.htm"; my $output=""; $template->process($temp_file,$vars,$output) or die $template->error(); print $output; print $q->end_html(); 以下是template.htm的檔案 仔細看喔[% var %] 那個pl的檔案在console下都可以正常執行 不過拿來當做cgi就會出現500的錯誤 請問到底錯在哪裡呢?? 謝謝~ (ps. 別的perl程式都可以正常執行 所以應該不是權限等等設定錯誤~~) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.62.97.25
synth:你有 "Content-type..." 嗎?! 221.169.96.188 12/04
shane123:print $q->header(); 就會自動輸出啦 61.62.97.25 12/05
henrynet:最後加個"1;"看看 140.116.131.114 12/10
shane123:ok...我試試看~~ 61.62.97.25 12/10