使用 composer 的 autoload 为 tinybutstrong 加载 OpenTBS 插件
Use composer's autoload to load OpenTBS plugin for tinybutstrong
我正在使用 tinybutstrong and it's opentbs plugin。到目前为止,我确实使用了两个源文件的明确要求,但我想切换到具有自动加载功能的作曲家。所以我想从这个开始
<?php
include 'tbs_class.php';
include 'tbs_plugin_opentbs.php';
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
对此(或类似的东西)
<?php
include 'vendor/autoload.php';
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
但是失败并出现错误 TinyButStrong Error with plug-in 'OPENTBS_PLUGIN': no class named 'OPENTBS_PLUGIN' is found, and no function named 'tbspi_OPENTBS_PLUGIN_OnInstall' is found.
所以似乎 composer 无法仅根据常量名称加载相关文件。
如何让作曲家自动加载插件文件?
<?php
//load composer's autoloader
require 'vendor/autoload.php';
//// Initialize the TBS instance
$TBS = new clsTinyButStrong; // new instance of TBS
$ok = class_exists('clsOpenTBS', true);
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);// load the OpenTBS plugin
我正在使用 tinybutstrong and it's opentbs plugin。到目前为止,我确实使用了两个源文件的明确要求,但我想切换到具有自动加载功能的作曲家。所以我想从这个开始
<?php
include 'tbs_class.php';
include 'tbs_plugin_opentbs.php';
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
对此(或类似的东西)
<?php
include 'vendor/autoload.php';
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
但是失败并出现错误 TinyButStrong Error with plug-in 'OPENTBS_PLUGIN': no class named 'OPENTBS_PLUGIN' is found, and no function named 'tbspi_OPENTBS_PLUGIN_OnInstall' is found.
所以似乎 composer 无法仅根据常量名称加载相关文件。
如何让作曲家自动加载插件文件?
<?php
//load composer's autoloader
require 'vendor/autoload.php';
//// Initialize the TBS instance
$TBS = new clsTinyButStrong; // new instance of TBS
$ok = class_exists('clsOpenTBS', true);
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);// load the OpenTBS plugin