2012-07-19 81 views
-1

你好,我有一个granit PHP函数,但想打印我自己的文本,它存储在一个变量中。添加一个变量到一个函数

这是怎样的代码看起来之前,我输入变量:

gradient('FF0000', '0000FF', 'my test goes here'); 

的正常工作,但现在我想把变量,其中文云,像这样

gradient('FF0000', '0000FF', '".$profile."'); 

刚刚在页面上反映出$ profile。我可以回显$配置文件,它工作正常,但我想添加granit功能。

我在做什么错?

+1

什么是“granit功能”? – arkascha 2012-07-19 14:46:40

回答

3

简单:

gradient('FF0000', '0000FF', $profile); 

或者:

$color1 = 'FF0000'; 
$color2 = '0000FF'; 
$profile = 'my test goes here'; 

gradient($colour1, $colour2, $profile); 
+1

谢谢从未想过:) – 2012-07-19 14:46:00

+0

这个工作然后渐变($ colour1,$ colour2,$ profile); ?? – 2012-07-19 14:59:31

+0

@NickDavies是的,它会 – xandercoded 2012-07-19 15:05:33

0
$profile = 'my test goes here'; 
gradient('FF0000', '0000FF', $profile); 

会工作。

+0

渐变($ colour1,$ colour2,$ profile);如果我把颜色放在其他两种颜色的一边 – 2012-07-19 15:00:03