我想之前$ thumb_directory“/图片”插入下面的代码相对URL和$ orig_directory但是我不知道如何在“撇号的”这样做的。此外,这是一个WordPress网站,因此,如果有人知道如何调用“/图片”中的函数,就像这样:“/图片”请让我知道(我知道,我刚才输入的是不正确的语法)

<?php
/* Configuration Start */
$thumb_directory = '/images';
$orig_directory = '/images';
$stage_width=600;
$stage_height=400;
/* Configuration end */
有帮助吗?

解决方案

假设的相对路径是在变量$rel_path, 用双引号:

$thumb_directory = "$rel_path/images";
$orig_directory = "$rel_path/images";

使用双引号变量(从$)由它们的值所替代,但这并不与单引号发生。

或者使用字符串连接:

$thumb_directory = $rel_path . '/images';
$orig_directory = $rel_path . '/images';

修改

如果您的相对路径来自bloginfo('template_directory'),简单地添加以下行的使用$rel_path(所以上面的行之前):

$rel_path = bloginfo('template_directory');

此设置与你想要的路径变量。 确保所有这些线是PHP处理标签<?php?>内,并且不要忘记在转让行的末尾的分号;; - )

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top