我认为是因为我没有正确引用数组。我是PHP的新手,所以我遇到了这个错误。
在这一行$this->fields['id'] => &$doc->id;
代码仅供参考:
<?php
class Zoho{
public $fields;
public function __construct(){
$this->fields = array(
// 'content' => "@/wamp/apps/researchportal/tmp/a.doc",
'apikey' => $this->api_key,
'output' => $this->output,
// 'id' => time(),
// 'filename' => $usr_bin.'_!@#$%^&^%$#@'.$usr_doc,
// 'format' => $ext,
'saveurl' => $this->save_url = $save_url,
'mode' => $this->mode
);
}
public function viewDocument(&$doc) {
$this->fields['id'] => &$doc->id;
$this->fields['filename'] => &$doc->doc_name;
$this->fields['format'] => &$doc->doc_ext;
$this->fields['mode']='view';
$this->fields['content']='@'.&$doc->path;
}
}
$document = new Document('C:/wamp/apps/researchportal/tmp/qubee.doc');
$zoho_s = new Zoho('http://133.223.121.12/researchportal/common/save.php');
$zoho->viewDocument();
?>
答案 0 :(得分:8)
public function viewDocument(&$doc) {
$this->fields['id'] => &$doc->id;
$this->fields['filename'] => &$doc->doc_name;
$this->fields['format'] => &$doc->doc_ext;
$this->fields['content'] = '@'.&$doc->path;
应该是:
public function viewDocument(&$doc) {
$this->fields['id'] = $doc->id;
$this->fields['filename'] = $doc->doc_name;
$this->fields['format'] = $doc->doc_ext;
$this->fields['content'] = '@' . $doc->path;