简体   繁体   English

定义PHP变量-PHP 101

[英]Defining PHP variables - PHP 101

I'm defining the following variables: 我正在定义以下变量:

$rel_path = bloginfo('template_directory');
$thumb_directory = "$rel_path/images/portfolio/";
$orig_directory = "$rel_path/images/portfolio/thumbs";

the $rel_path is a WordPress function which appears to be printing, however, it is displaying spitting an error message which indicates that $rel_path is printing but somehow not being joined with /images/portfolio so the URL is not returning properly $rel_path是一个似乎正在打印的WordPress函数,但是,它会显示一则错误消息,表明$rel_path正在打印,但以某种方式未与/ images / portfolio联接,因此URL无法正确返回

The error looks like this: 错误看起来像这样:

http://localhost:8888/_test_wordpress/wp-content/themes/v3_1_magickThere is an error with your image directory! http:// localhost:8888 / _test_wordpress / wp-content / themes / v3_1_magick您的图片目录存在错误!

bloginfo() echoes data instead of returning a string. bloginfo()回显数据而不是返回字符串。 You are looking for: 您正在寻找:

get_bloginfo() get_bloginfo()

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

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