简体   繁体   English

这两个Wordpress函数有什么区别?

[英]What is the difference between this two Wordpress function?

What is the difference between this two Wordpress function: 这两个Wordpress函数之间有什么区别:
plugin_dir_url vs plugin_dir_path . plugin_dir_urlplugin_dir_path
Thanks for your help. 谢谢你的帮助。

Return values of the Two mentioned functions 返回上述两个函数的值

  1. plugin_dir_path( FILE ) returns the servers filesystem directory path pointing to the current file, ie something along the lines of plugin_dir_path( FILE )返回指向当前文件的服务器文件系统目录路径,即类似于

/home/www/your_site/wp-content/plugins/your-plugin/includes/ / home / www / your_site / wp-content / plugins / your-plugin / includes /

This can be used for loading PHP files. 这可用于加载PHP文件。

  1. plugin_dir_url() behaves in a very similar fashion to plugins_url(). plugin_dir_url()的行为与plugins_url()非常相似。 It also returns a web address, but with a trailing slash, ie something along the lines of 它还返回一个网址,但后跟斜杠,即

http://example.com/wp-content/plugins/ http://example.com/wp-content/plugins/

This can be used to load images, stylesheets, JS and the like 这可用于加载图像,样式表,JS等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM