【问题标题】:nanoc does not find my PHP files on autocompilenanoc 在自动编译时找不到我的 PHP 文件
【发布时间】:2013-03-05 10:33:01
【问题描述】:

我正在使用nanoc 构建一个静态网站,其中包含用于发送邮件的 PHP 脚本。简化结构:

/content/index.html
/content/contact.html
/content/mail.php

但是,当我执行 nanoc compile 时,我的输出文件夹中的一切都很好:

index.html
contact/index.html
mail/index.php  

但在执行nanoc autocompile 时,我无法调用 PHP 脚本。 /contact/ 有效,但 /mail/ 无效。

这是我的规则文件的一部分:

route '*' do
    if item.binary?
        # Write item with identifier /foo/ to /foo.ext
        original_filename(item)
    else
        # Write item with identifier /foo/ to /foo/index.extension
        item.identifier + "index.#{item[:extension]}"
    end
end

PHP 被视为非二进制。有谁知道我怎样才能让它与autocompile一起工作?

【问题讨论】:

    标签: nanoc


    【解决方案1】:

    如果有人遇到类似问题:我找到了answer:

    自动编译器不支持 PHP 文件。如果一个目录 请求时,自动编译器会在其中查找 index.html 文件,但是 它将忽略 index.php 文件。自动编译器找不到 MIME 键入它,因此它将文件作为 application/octet-stream 发送回 浏览器。

    这很明显,但我没想到自动编译会运行一个不支持 PHP 的轻量级服务器(当然)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-22
      • 1970-01-01
      • 1970-01-01
      • 2014-07-21
      • 1970-01-01
      相关资源
      最近更新 更多