web-dev-qa-db-ja.com

外部スクリプトからJoomlaにアクセスする場合、( 'libraries / joomla / factory.php');?

私は外部のphpスクリプトからJoomlaにアクセスする方法について読んでいて、require('libraries/joomla/factory.php');を使用するコードと外部のものを使用するコードの2種類の傾向があることに気付きました。

factory.phpは必要ないようですが、どのような理由でそれを含めますか?

編集これは、factory.phpを使用するコードの例です

define('_JEXEC', 1);
define('JPATH_BASE', realpath(dirname(__FILE__)));
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );
require_once ( JPATH_BASE .'/libraries/joomla/factory.php' );
1
TryHarder

使用するかどうかによって異なりますJFactory::呼び出し。次のような便利な関数を提供します。

getApplication
getConfig
getSession
getLanguage
getDocument
getUser
getCache
getACL
getDbo
getMailer
getFeedParser
getXML
getEditor
getURI
getDate
createConfig
createSession
createDbo
createMailer
createLanguage
createDocument
getStream

それを使う理由はたくさんあります。

1
Craig