How to extend Joomla! to my custom PHP file(如何扩展 Joomla!到我的自定义 PHP 文件)
本文介绍了如何扩展 Joomla!到我的自定义 PHP 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个 php 文件.我想扩展所有的 Joomla!类到该文件.或者我至少希望能够使用 Joomla 的类来访问我的 PHP 文件中的数据库.我怎样才能以这种方式扩展功能?提前致谢.
I have a php file i created. I want to extend all the Joomla! classes to that file. Or i at least want to be able to use Joomla's class for accessing the database within my PHP file. How can I extend the functionality that way? Thanks in advance.
推荐答案
将这些行放在 php 文件的顶部
put these lines on top of your php file
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__).'/../../../../' ); // should point to joomla root
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
现在你可以在这里使用所有的 joomla 类
now you can use all joomla classes here
这篇关于如何扩展 Joomla!到我的自定义 PHP 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:如何扩展 Joomla!到我的自定义 PHP 文件
基础教程推荐
猜你喜欢
- PHP 类:全局变量作为类中的属性 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
