所以我已经通过作曲家为我的主题安装了createsend-php(我正在尝试学习如何使用它),但无法进入下一阶段。
我可以在这里看到API - /wp-content/themes/wonkhe2-theme/vendor/campaign-monitor/createsend-php/
作曲家文件似乎对我来说 -
"require": {
"php": ">=5.4.0",
"composer/installers": "~1.0",
"campaignmonitor/createsend-php": ">=6.0"
}
在/wp-content/themes/wonkhe2-theme/templates/content-signup-cm.php我添加了require_once 'csrest_campaigns.php'
那回报
Fatal error: require_once(): Failed opening required 'csrest_campaigns.php' (include_path='.:/Applications/MAMP/bin/php/php7.2.7/lib/php') in /wp-content/themes/wonkhe2-theme/templates/content-signup-cm.php on line 5
require_once路径应该不同吗?我以为自动加载器会设置路径和命名空间。
使用作曲家对我来说是新的,如果我误解,但任何帮助表示赞赏,请道歉。
你不应该要求作曲家安装个别课程。相反,在代码的开头:
require_once 'vendor/autoload.php';
然后你可以开始使用对象;
use Some\Class\Or\Other;
$object = new Other();