【发布时间】:2023-03-20 09:57:01
【问题描述】:
现在对如何完成将参数传递到 fatfree f3 路由有点困惑。
我的设置如下例所示:
$f3->route('GET /tweetRate/@currency','Tweets\tweetInterface::tweet');
我在 tweetInterface 类上的“tweet”方法能够接受一个参数,但我永远无法真正确认它正在被传入。
static function tweet($currency) {
echo 'Inside Route';
echo $currency;
}
我已经确认我能够到达这条路线,因为我的“Inside Route”的第一个回显能够被打印出来,但是在回显参数时没有任何东西出现在 $currency 上。以下是我如何调用此路由的示例:
php routes.php "/tweetRate/USD" > /Users/johndoe/Desktop/test.log
在“test.log”内部,我可以看到上面提到的第一个 echo 语句。
任何帮助将不胜感激!
【问题讨论】:
标签: php parameter-passing fat-free-framework