[英]using composer and autoload in wordpress theme, 'Failed opening required'
因此,我已经通过composer为主题安装了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路径应该不同吗? 我以为自动加载器会设置路径和名称空间。
使用composer对我来说是新手,所以如果我误会了我,我对此表示歉意,但对您的帮助不胜感激。
您不应要求作曲家单独授课。 相反,就在代码开头:
require_once 'vendor/autoload.php';
然后就可以开始使用对象了;
use Some\Class\Or\Other;
$object = new Other();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.