Variable won't echo in string


Variable won't echo in string

我试图在$image_all内部回声变量$theurl,但它不起作用。

$theurl = OF_DIRECTORY;
$image_all =  $theurl.$image_path;

这应该很简单,对吧?它只显示$image_path等于什么,即使如果我简单地执行<?php echo $theurl; ?>,它将返回$theurl

我错过了什么?

让我们做一个非常非常简单的例子:

define(OF_DIRECTORY, 'blabla/test/');
$image_path = 'file.php';
$theurl = OF_DIRECTORY;
$image_all =  $theurl.$image_path;
echo $image_all;
顺便说一下,

工作得很好!但是,为什么要使用$theurl呢?为什么不是$image_all = OF_DIRECTORY . $image_path;呢?你需要提供更多的信息或代码,但就你的规格而言,一切都应该没问题。