作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何将未找到的用户定义错误页面和服务器错误页面重定向到用户定义页面 Mojolicious lite
最佳答案
您可以为名为 exception.html.ep
的自定义页面添加模板。或 not_found.html.ep
在你的 liteapp 结束时。
例如:
use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
$self->render(text => "Hello.");
};
app->start;
__DATA__
@@ not_found.html.ep
<!DOCTYPE html>
<html>
<head><title>Page not found</title></head>
<body>Page not found <%= $status %></body>
</html>
The renderer will always try to find exception.$mode.$format.* or not_found.$mode.$format.* before falling back to the built-in default templates.
关于perl - Mojolicious lite 如何将未找到和服务器错误页面重定向到用户定义的错误页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13272220/
我是一名优秀的程序员,十分优秀!