【发布时间】:2015-07-05 13:48:11
【问题描述】:
我正在使用 Ajax 将 JS 变量传输到我的脚本 PHP 以更改背景颜色。你能帮我实现这个目标吗?我不知道如何在这里使用连接并使用 $mavariable。
$mavariable=$_POST['background'];
echo $mavariable; //Return the string blue
$backgroundcolor='background-color:green;';
$background='/background-color:yellow;/'; //How to use $mavariable here ?
$contenuMod=preg_replace($background, $backgroundcolor,$lineContent); //This works if i'm not using $mavariable
【问题讨论】:
-
请详细说明。你如何使用
$mavariable? -
替换字符串“yellow”
标签: javascript php ajax string concatenation