我正在尝试使用Zend Service Livedocx。我在我的应用程序中使用了两个模型 - 提交和SubmissionFiles。我使用SubmissionController中的Create操作保存Submission数据和SubmissionFiles数据。我试图在该操作中调用MailMerge类但我收到错误:致命错误:无法在C:\ wamp \ www \ publications \ src \ web \ protected \ vendors \中重新声明类ZendService \ LiveDocx \ AbstractLiveDocx ZendService \ LiveDocx \ AbstractLiveDocx.php
//一些代码
public function actionCreate()
{
$model=new Submission;
if(isset($_POST['Submission']))
{
$model->attributes=$_POST['Submission'];
if($model->save())
{
$modelFile = new SubmissionFiles;
if(isset($_POST['SubmissionFiles']))
{
Yii::import('application.vendors.zendservice.livedocx.*');
$phpLiveDocx = new MailMerge();
//somecode
<?php
require_once 'ZendService\LiveDocx\AbstractLiveDocx.php';
class MailMerge extends AbstractLiveDocx
{ //somecode
<?php
namespace ZendService\LiveDocx;
use Traversable;
use Zend\Soap\Client as SoapClient;
use Zend\Stdlib\ArrayUtils;
abstract class AbstractLiveDocx
{ //some code
如果我评论require_once&#39; ZendService \ LiveDocx \ AbstractLiveDocx.php&#39 ;;在MailMerge.php中, 我收到错误: 致命错误:Class&#39; AbstractLiveDocx&#39;在C:\ wamp \ www \ publications \ src \ web \ protected \ vendors \ ZendService \ LiveDocx \ MailMerge.php
中找不到我做错了什么?
答案 0 :(得分:0)
我猜你正在使用作曲家将Zend作为依赖。如果是这样,你必须将自动加载器添加到你的index.php文件(或任何你引导的文件)。
// change the following paths if necessary
require_once(dirname(__FILE__).'/../vendor/autoload.php');
之后,将require_once行替换为:
use ZendService\LiveDocx\AbstractLiveDocx;
希望有效:)