Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php href don'内的变量;我不能如愿工作_Php_Html - Fatal编程技术网

Php href don'内的变量;我不能如愿工作

Php href don'内的变量;我不能如愿工作,php,html,Php,Html,我创建了一个函数,在其中我创建了一个表。 该函数本身运行正常,但我需要指向其他页面的链接。 在该页面中,我使用GET变量,因此它们需要进入URL内部。 我得到: $calendar.= '<div class="day-number"><a href="http://localhost/PHPOrdner/Calendar/Day.php?inputmonth='$inputMonth'&inputyear='$inputYear'&day='$list_day

我创建了一个函数,在其中我创建了一个表。
该函数本身运行正常,但我需要指向其他页面的链接。
在该页面中,我使用GET变量,因此它们需要进入URL内部。
我得到:

$calendar.= '<div class="day-number"><a href="http://localhost/PHPOrdner/Calendar/Day.php?inputmonth='$inputMonth'&inputyear='$inputYear'&day='$list_day'"></a>'.$list_day.'</div>';
$calendar.='.$list_day';
但这是行不通的:

分析错误:语法错误,意外的“$inputMonth”(T_变量) 在…

我试图避开'like:
../Day.php?inputmonth=\'$inputmonth\'…

但这会使我的URL中出现“../Day.php?inputmonth=%27$inputmonth%27…”,因此我需要变量的代码不起作用。

使用
也不起作用。

我还是新手,还有其他方法吗?

您的字符串连接错误您忘记了

$calendar = '<div class="day-number"><a href="http://localhost/PHPOrdner/Calendar/Day.php?inputmonth='.$inputMonth.'&inputyear='.$inputYear.'&day='.$list_day.'"></a>'.$list_day.'</div>';
尝试:

$calendar.='.$list_day';

您缺少

$calendar = '<div class="day-number"><a href="http://localhost/PHPOrdner/Calendar/Day.php?inputmonth='.$inputMonth.'&inputyear='.$inputYear.'&day='.$list_day.'"></a>'.$list_day.'</div>';
$calendar='.$list_day';

你不能仅仅把一个变量放在字符串旁边,你要把它们放在一起。不要成为
吝啬鬼
添加更多的
点来连接字符串。我不知道原因是字符串连接,否则我就不会问了。很抱歉,这是重复的。