使用Zend服务亚马逊亚马逊、Zend

2023-09-11 11:06:52 作者:爱生活,更爱挺自已

本来,我正在寻找如何使用PHP来从亚马逊的图书信息。我发现这个问题:

Originally, I was searching how to use php to retrieve book information from amazon. and I found this question:

How我可以使用亚马逊的API在PHP中搜索图书?

我想这样的作品,但我有愚蠢的问题。我不能够安装和使用 Zend的服务亚马逊。我下载了约60 MB的软件,但已损坏。

I think this works, but I am having stupid question. I am not able to install and use Zend Service Amazon. I downloaded the software of around 60 MB but, was corrupted.

可能是,其实我是想一些PHP文件来实现它。但是,它给一些EXE文件。

May be, I actually want some php files to implement it. but, its giving some kind of exe file.

所以,在这里我的问题是;

so, here my question is;

我在哪里可以下载的Zend框架? 如何安装呢? 我如何使用它?

Where do I download Zend framework? How do I install it? How do I use it?

在此先感谢

推荐答案

有关Zend Framework的官方下载可以找到的这里。既然你打算使用ZF更多的是比MVC应用程序框架库,你只需要下载小得多的最小封装。

The official download for Zend Framework can be found here. Since you intend to use ZF more as a library than an MVC application framework, you only really need to download the much smaller minimal package.

这是在看亚马逊的文件,你有兴趣,我认为以下文件的列表中你需要复制到你的应用程序才能使用Zend框架亚马逊服务的API(的当我用ZF作为一个库,我总是尽量只包括我会用,而不是全包的实际文件,但对于初学者,你可以只复制整个的Zend 文件夹来获得去的):

From looking at the Amazon files you are interested in, I think the list of the following files are all you would need to copy into your application in order to use the Zend Framework Amazon Service APIs (when I use ZF as a library, I always try to only include the actual files I will be using, rather than the whole package, but for starters you can just copy the entire Zend folder to get going):

Zend/Exception.php

Zend/Loader.php
Zend/Loader/Autoloader.php
Zend/Loader/Exception.php

Zend/Uri.php
Zend/Uri/Exception.php

Zend/Service/Abstract.php
Zend/Service/Amazon.php
Zend/Service/Exception.php

Zend/Service/Amazon/Abstract.php
Zend/Service/Amazon/Accessories.php
Zend/Service/Amazon/Authentication.php
Zend/Service/Amazon/CustomerReview.php
Zend/Service/Amazon/EditorialReview.php
Zend/Service/Amazon/Image.php
Zend/Service/Amazon/Item.php
Zend/Service/Amazon/ListmaniaList.php
Zend/Service/Amazon/Offer.php
Zend/Service/Amazon/OfferSet.php
Zend/Service/Amazon/Query.php
Zend/Service/Amazon/ResultSet.php
Zend/Service/Amazon/SimilarProduct.php

Zend/Rest/Client.php
Zend/Rest/Client/Result.php
Zend/Rest/Client/Result/Exception.php

Zend/Crypt.php
Zend/Crypt/Exception.php
Zend/Crypt/Hmac.php
Zend/Crypt/Hmac/Exception.php

如果我错过了任何,请原谅我;你应该得到一个异常说找不到类,如果我留下任何出,这应该是pretty的很容易解决,你需要哪些附加文件(S),包括。

If I missed any, forgive me; you should get an exception saying class not found if I left any out, and that should be pretty straightforward to resolve which additional file(s) you need to include.

为了使用Zend框架的的我建议做如下:

首先,添加Zend框架的文件到你的PHP的include_path 。为了使用ZF的文件,你需要preserve他们使用的目录结构,最起码,你需要一个的Zend 文件夹中的所有ZF文件在那里。

First and foremost, add Zend Framework's files to your PHP include_path. In order to use the ZF files, you need to preserve the directory structure they use, at the very least, you need a Zend folder with all the ZF files in there.

添加到您的包括像这样的路径:

Add to your include path like this:

set_include_path(get_include_path() . PATH_SEPARATOR . '/zf/folder/path');

ZF /文件夹/路径应的路径在的Zend 目录中的文件夹,但要一定不要实际上包含的Zend 文件夹中包含路径(从Zend确实 require_once'的Zend /为file.php';

zf/folder/path should be the path to the folder that the Zend directory is in, but make sure not to actually include the Zend folder in the include path (since Zend does require_once 'Zend/File.php';

其次,设置自动加载磁带机如果可能的。如果您决定使用Zend框架自动加载磁带机,你就不必手动'require_once'许多ZF文件。

Secondly, set up the autoloader if possible. If you decide to use the Zend Framework autoloader, you won't have to manually 'require_once' many of the ZF files.

要设置其自动加载器,所有你需要做的就是它的一个实例:

To set up their autoloader, all you have to do is get an instance of it:

require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();

您不需要保存或与 $自动加载磁带机做任何事情。只是,电话就足以注册了Zend自动加载器。由于ZF文件都在你的路径,它会自动知道如何加载,并找到所有采埃孚文件。

You don't need to save or do anything with $autoloader. Just that call is enough to register the Zend autoloader. Since the ZF files are in your path, it will automatically know how to load and locate all ZF files.

在执行这些步骤,您就可以通过使用Zend框架亚马逊服务在你的PHP应用程序。

After you perform those steps, you are able to use the Amazon services via Zend Framework in your PHP application.

至于使用的细节,希望你可以找到所有的细节,并帮助你需要在这里的 Zend_Service_Amazon参考指南。参考手册应该是你最好的选择,但你总是可以找到的phpDocumentor类文档这里。

As for the details of using that, hopefully you can find all the details and help you need here, Zend_Service_Amazon Reference Guide. The reference guide should be your best bet, but you can always find the phpDocumentor class documentation here.

希望帮助!随意问,如果你需要澄清什么。

Hope that helps! Feel free to ask if you need clarification on anything.

 
精彩推荐