88 个回复 | 最后更新于 2017-12-12
回复#44 @ivanilla :
https://yetanloushi.com/mytest.php 我搜了demo
<?php //定义一个变量 $name = 'baidu'; //定义一个动态变量 $$name = 'newbaidu'; echo $$name; echo '<br>'; echo $baidu; echo '<br>'; //上面的定义等同于下面的定义 $baidu = 'newbaidu'; echo $baidu; ?>
结果
newbaidu
newbaidu
newbaidu
可以得出结论是支持动态变量么 。
controller/user.php
<?php require(LanguagePath . 'user.php'); //$UserName = Request('Get', 'username'); $UserName = urldecode(Request('REQUEST', 'username')); $UserInfo = array(); $UserInfo = $DB->row('SELECT * FROM ' . PREFIX . 'users Where UserName=:UserName', array( 'UserName' => $UserName )); if (!$UserInfo) AlertMsg('404 Not Found', '404 Not Found', 404); if ($CurUserID) $IsFavorite = $DB->single("SELECT ID FROM " . PREFIX . "favorites Where UserID=:UserID and Type=3 and FavoriteID=:FavoriteID", array( 'UserID' => $CurUserID, 'FavoriteID' => $UserInfo['ID'] )); $PostsArray = $DB->query('SELECT * FROM ' . PREFIX . 'posts Where UserName=:UserName and IsDel=0 ORDER BY PostTime DESC LIMIT 30', array( 'UserName' => $UserInfo['UserName'] )); $DB->CloseConnection(); $PageTitle = $UserInfo['UserName']; $PageMetaDesc = $UserInfo['UserName'] . ' - ' . htmlspecialchars(strip_tags(mb_substr($UserInfo['UserIntro'], 0, 150, 'utf-8'))); $ContentFile = $TemplatePath . 'user.php'; include($TemplatePath . 'layout.php');
user模块也是如此
登录后方可回帖
有可能。