简体   繁体   English

如何使用可用的Zend应用程序类创建独立的.php

[英]How to create standalone .php with Zend Application classes available in it

I am new with Zend Framework and I couldn't find an answer anywhere so I would like to ask you. 我是Zend Framework的新手,我在任何地方都找不到答案,所以我想问你。

I have an application ready, all is working well in browser but I would like to run once a day one .php file which will be processing the data and downloading some more from other SQL server. 我已经准备好一个应用程序,所有浏览器都可以正常运行,但是我想每天运行一个.php文件,该文件将处理数据并从其他SQL Server下载更多文件。 I would like to be able to access all classes/functions, basically everything from my Zend Application. 我希望能够访问所有类/函数,基本上可以访问Zend应用程序中的所有内容。

I know how to set up the CRON, I just don't know what should I put into .php file to get all functions from the project available for me as well as DB connections. 我知道如何设置CRON,只是不知道应该把什么放入.php文件中,以获取项目中所有可用的功能以及数据库连接。

I'm using Zend Framework 1.11.11 我正在使用Zend Framework 1.11.11

Thanks guys, Mirko. 谢谢大家,米尔科。

As i understand, you can include Zend Framework Autoloader, in your standalone file, and after this you can use any Zend Framework Classes. 据我了解,您可以在独立文件中包含Zend Framework Autoloader,此后,您可以使用任何Zend Framework类。

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

read more here 在这里阅读更多

But it's not cool =) 但这并不酷=)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM