Home  >  Article  >  Backend Development  >  @include("$r[title].php"); 应该怎么写,有个变量

@include("$r[title].php"); 应该怎么写,有个变量

WBOY
WBOYOriginal
2016-06-23 13:36:36845browse

$r[title]的值为youku或者tudou或者qiyi
但是里面有变量,怎么加引号之类的就是不行,求解决


回复讨论(解决方案)

r[title].'.php'

include("$r[title].php");
你这样写并无问题

include("{$r['title']}.php");

这样写

楼上几位的试了下,均无效

贴出你的代码


$file = $r[title].php;
include($file); 

这样简单些

无效 是怎么个无效法?  include失败  还是文件解析都不通过??

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn