用PHP可以这样吗? [英] Is something like this possible with php?
问题描述
我想看看这是否可行。我已经考虑过了,并且
无法看到一个简单的方法。
好吧我说我有一个剧本
< ;?php
//这些变量在脚本中设置
$ fname =''萌'';
$ bday ='''1970'';
//从mysql中提取字段
//从someTable limit 1中选择someField;
//变量someField包含此值
// $ someField =''欢迎回来$ fname!哇,你必须是一个老屁,因为
你出生在$ bday''
你可以看到变量存储在带有嵌入式的mysql表中
字符串本身的变量。我想做的是以某种方式评估这些
变量,以便$ someField值包含这个
值
欢迎回到萌!哇你自从出生以来一定是个老屁
1970
?>
Hi,
I am trying to see if this is possible. I have thought about it and
cant see an easy way to do this.
OK say I have a script
<?php
//these variables get set in the script
$fname=''Moe'';
$bday=''1970'';
//extract a field from mysql
//select someField from someTable limit 1;
//the variable someField contains this value
//$someField=''Welcome back $fname ! wow you must be an old fart since
you were born in $bday''
As you can see the variable is stored in the mysql table with embedded
variables in the string itself. What I would like to do is have these
variables evaluated somehow so that the $someField value contains this
value
Welcome back Moe ! wow you must be an old fart since you were born in
1970
?>
推荐答案
fname =''Moe'';
fname=''Moe'';
bday =''1970'';
//提取一个来自mysql的字段
//从someTable限制1中选择someField;
//变量someField包含此值
//
bday=''1970'';
//extract a field from mysql
//select someField from someTable limit 1;
//the variable someField contains this value
//
someField =''欢迎回来
someField=''Welcome back
这篇关于用PHP可以这样吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!