// Retrieve a query parameter named 'id' $request = new AphrontRequest($_REQUEST); $id = $request->getStr('id'); // Output the ID echo 'ID: ' . $id;
// Retrieve an optional query parameter named 'name' $request = new AphrontRequest($_REQUEST); $name = $request->getStr('name', 'Unknown'); // Output the name echo 'Name: ' . $name;This code creates a new AphrontRequest object from the $_REQUEST superglobal and uses the getStr method to retrieve the 'name' query parameter as a string. If the parameter is not present in the request, the default value 'Unknown' is returned instead. The resulting value is then output to the user. The AphrontRequest library is part of the Phabricator project.