我尝试过使用Joomla Framework,我的更新工作正常,但如何使用变量进行更新。 Fx的:
$test = 'Hello';
$fields = array(
$db->quoteName('test_column') . ' = ' . $db->quote('$test')
);
如何在此行中编写$test
变量?
答案 0 :(得分:0)
In php, you want to single quote ('
) strings when you want to output them as you see them, and double quotes ("
) when you want the string to be parsed for variables. All you need to do is change the quotes around $test
, or more simply remove them as they aren't needed here:
$test = 'Hello';
$fields = array(
$db->quoteName('test_column') . ' = ' . $db->quote($test)
);