LoginSignup
3
4

More than 5 years have passed since last update.

TreeFrogでクエリ文字列(URLパラメータ)を取得する

Last updated at Posted at 2014-06-26

Blog/index?p=2&s=0のような形式のパラメータを取得する方法です。

クエリ形式のパラメータの取得

C++
int p = httpRequest().queryItemValue("p").toInt();
int s = httpRequest().queryItemValue("s").toInt();

パラメータが存在するか確認

C++
if (httpRequest().hasQueryItem("p"))
{
    // pというパラメータが存在する
    int p = httpRequest().queryItemValue("p").toInt();
}
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4