【发布时间】:2014-02-17 20:02:41
【问题描述】:
我正在试验 Michel Fortin 的 PHP-Markdown 库,但无法让它在我的服务器上运行。
我已将解析器库文件上传到服务器的 / 子文件夹中。我的 testmd.php 文件是一个文件夹。目前,我正在使用下面的代码来 require_once 文件,但是我的 markdown(链接)的单个测试行没有被解析。为了让 PHP-markdown 库适用于这样的示例,我还需要做些什么或包括其他事情吗?
testmd.php
<?php
require_once ('subfolder/Markdown.inc.php');
require_once ('subfolder/includetest.php');
?>
<html>
<body>
<?php
use \Michelf\Markdown;
$html = Markdown::defaultTransform('[Test](www.google.com)');
?>
</body>
</html>
在上面的代码中,includetest.php 只是一个测试包含文件,以确保我没有在那里犯错。该文件包含在输出中,但不包含 MD 链接。没有出现错误,所以输出如下:
输出
This is text from the includetest.php file.
由于我是 PHP 新手,非常感谢任何帮助!
【问题讨论】:
-
你只是嵌入了库文件,没有真正调用它——你需要像
Markdown::defaultTransform('your text here')这样的东西……
标签: php markdown require-once php-include