0
我有条纹插件安装在wp-content/plugins/stripe /。我在theme/fifthteen/Payment.php中有一个名为“Payment.php”的页面。现在我想在我的Payment.php中包含文件wp-content/plugins/stripe/Stripe.php。我怎样才能做到这一点?如何在Wordpress插件文件夹中需要文件?
我有条纹插件安装在wp-content/plugins/stripe /。我在theme/fifthteen/Payment.php中有一个名为“Payment.php”的页面。现在我想在我的Payment.php中包含文件wp-content/plugins/stripe/Stripe.php。我怎样才能做到这一点?如何在Wordpress插件文件夹中需要文件?
使用 plugins_url($ path,$ plugin);
$路径将持有的文件的路径在你的插件
$path = 'stripe.php';
$插件握着你的插件的名称
$plugin='stripe' ;
include plugins_url($path,$plugin) ;
那么,这将是 需要plugins_url('LIB /条。 PHP”, 'WP-完全条带'); 其中: lib/Stripe.php是我的插件中的文件的路径,并且, wp-full-stripe是插件名称(wp-content/plugins中的文件夹名称)? – Andiana
是的。这会很好地工作。 – Nazim
我得到了一个致命错误: 致命错误:require():无法打开所需的'http://localhost/wordpress/wp-content/plugins/lib/Stripe.php'(include_path ='.; D:\ xampp \在线259( - >上面的require语句的行)D:\ xampp \ htdocs \ wordpress \ wp-content \ themes \ twentyfifteen \ paytest.php – Andiana