【问题标题】:Upload a document using Zend gdata使用 Zend gdata 上传文档
【发布时间】:2011-10-31 21:01:05
【问题描述】:

我正在尝试使用 zend gdata 库将一个简单的 csv 文档上传到谷歌文档,但不知何故它卡住了。

我查看了所有用于上传的文件,发现卡在哪里:

上线:Zend/Gdata/Docs.php 229 后:$fs = $this->newMediaFileSource($fileLocation);

即使我查看了每个文件,我也找不到 newMediaFileSource() 函数。任何人都知道我该如何解决这个问题?

public function uploadFile($fileLocation, $title=NULL, $mimeType=NULL, $uri=NULL)
    {
        // Set the URI to which the file will be uploaded.
        if ($uri === NULL) {
            $uri = $this->_defaultPostUri;
        }
        // Right after this line it stops executing:
        $fs = $this->newMediaFileSource($fileLocation);
        if ($title !== NULL) {
            $slugHeader = $title;
        } else {
            $slugHeader = $fileLocation;
        }

【问题讨论】:

    标签: php zend-gdata


    【解决方案1】:

    我也有类似的问题。我也找不到这个函数,所以我怀疑它使用了一个神奇的 php 调用,果然在 Zend_Gdata_App 第 1041 行:

    public function __call($method, $args)
    {
        if (preg_match('/^new(\w+)/', $method, $matches)) {
            $class = $matches[1];
            $foundClassName = null;
            foreach ($this->_registeredPackages as $name) {
                 try {
                     // Autoloading disabled on next line for compatibility
                     // with magic factories. See ZF-6660.
                     if (!class_exists($name . '_' . $class, false)) {
                        require_once 'Zend/Loader.php';
                        @Zend_Loader::loadClass($name . '_' . $class);
                     }
                     $foundClassName = $name . '_' . $class;
                     break;
                 } catch (Zend_Exception $e) {
                     // package wasn't here- continue searching
                 }
            }
    
         ....
    }
    

    它基本上是解析方法名来检查“new”之后是否有包

    它基本上是创建一个 Zend_Gdata_App_MediaFileSource 类型的对象

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-02
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多