PHP调用成员函数toXML

时间:2016-05-12 13:28:40

标签: php

<?php
require_once('spell-check-library.php');
$content = "Hello";
 $options = array(
  "lang"                    => 'en',
"maxSuggestions"        => 10,
"customDict"            => 0,
"charset"               => 'utf-8'
);
$factory = new SpellChecker($options);

$spell = $factory->create(trim("Ths is a tst"));

header('Content-Type: text/xml; charset=UTF-8');
echo $spell->toXML();
?>

我使用了这段代码,我得到了这个错误

致命错误:在第15行的/home/ubuntu/workspace/include/checker.php中的非对象上调用成员函数toXML()

调用堆栈:     0.0003 232720 1. {main}()/home/ubuntu/workspace/include/checker.php:0

我该如何解决?

1 个答案:

答案 0 :(得分:0)

工厂未能创建对象咒语,也许你需要检查创建第一个

的参数