PHP: 在 other 中添加 echo 内容

PHP: Adding echo contents inside an other

我正在使用一个 php 回显来添加元标记 og:image,如下所示:

1

echo "<meta property=\"og:image\" content=\"https://example.com/Gallery/$b/$new/imagename-$b-$new-$three.jpg\" />";

并回显此图像 url:https://example.com/Gallery/book/new/imagename-book-new-3.jpg

2

然后我开始使用 phpThumb 调整 url 参数中的图像尺寸(因为我没有找到更简单的方法),回声是:

echo '<img src="'.htmlspecialchars(phpThumbURL('src=https://example.com/Gallery/book/new/imagename-book-new-3.jpg&w=100&h=200', '/phpThumb/phpThumb.php')).'">';

我需要做的是合并第一个内的 2 个 echo(没有 img src 部分)!

我尝试了很多,我想要的是这样的:

结果

echo "<meta property=\"og:image\" content=\"'.htmlspecialchars(phpThumbURL('src=https://example.com/Gallery/$b/$new/imagename-$b-$new-$three.jpg&w=100&h=200&iar=1', '/zJ/phpThumb/phpThumb.php')).'\" />";

将单引号改为双引号,以便执行中间的连接部分(不打印为静态字符串)。

echo "<meta property=\"og:image\" content=\""
     . htmlspecialchars(phpThumbURL("src=https://example.com/Gallery/$b/$new/imagename-$b-$new-$three.jpg&w=100&h=200&iar=1", '/zJ/phpThumb/phpThumb.php'))
     . "\" />";