[英]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.