您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php 双引号里面的解析

2024/2/23 1:39:09发布20次查看
echothis works: {$arr['foo'][3]};echothis works too: {$obj->values[3]->name};echothis is the value of the var named $name: {${$name}};echovalue of the var named by the return value of getname(): {${getname()}};echovalue of the var named by the return value of \$object->getname(): {${$object->getname()}};
解析数组
$juices = array(apple, orange, koolaid1 => purple);echohe drank some $juices[0] juice..php_eol;echohe drank some $juices[koolaid1] juice..php_eol;// 有效,只有通过花括号语法才能正确解析带引号的键名echothis works: {$arr['key']};// 有效echothis works: {$arr[4][3]};
解析变量
echothis is {$great};echothis is ${great};
输出字符串
$a = 'aaaa';$c['c'] = ccc;$b = i am '$a' and '$c[c]' \ 我是双引号!\;echo$b; //i am 'aaaa' and 'ccc' 我是双引号!
{}的解析
classbeers {const softdrink = 'rootbeer'; publicstatic$ale = 'ipa';}$rootbeer = 'a & w';$ipa = 'alexander keith\'s';// 有效,输出: i'd like an a & wechoi'd like an {${beers::softdrink}}\n;// 也有效,输出: i'd like an alexander keith'sechoi'd like an {${beers::$ale}}\n;
解析对象
// 有效echo this square is {$square->width}00 centimeters broad.;
版权声明:知识取之于民,用之于民!欢迎转载,转载请开头附上本文链接,不定期更新文章!
以上就介绍了php 双引号里面的解析,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product