質問はかなり自明だと思います。コードは次のとおりです。
HTTP リクエスト: localhost/execute.php?password=testing&command=create&api=api
これは実行コードの一部です。
try
{
$TFA_SAMP->createUser($_GET['email'], $_GET['cellphone'], $_GET['area_code']);
}
catch(Exception $createError)
{
echo $createError->getMessage();
}
クラスメソッドは次のとおりです。
function createUser($email, $cellphone, $areaCode = 1)
{
if(!isset($email))
throw new BadMethodCallException('(CTFA_SAMP->createUser) email ('. $email .') is missing.');
if(!isset($cellphone))
throw new BadMethodCallException('(CTFA_SAMP->createUser) cellphone ('. $cellphone .') is missing.');
$authyLibrary = new Authy_Api($this->API, $this->connectionURL);
$requestResult = $authyLibrary->registerUser($email, $cellphone, strval($areaCode));
if($requestResult->ok())
{
echo $requestResult->id();
}
else
{
foreach($requestResult->errors() as $field => $message)
echo "$field = $message";
}
}
PHP ページは以下を出力します。
Notice: 未定義のインデックス: email in D:\xampp\htdocs\tfasamp\execute.php 行 46
Notice: 未定義のインデックス: cellphone in D:\xampp\htdocs\tfasamp\execute.php 行 46
注意: 未定義のインデックス: D:\xampp\htdocs\tfasamp\execute.php の 46 行目の area_code
(CTFA_SAMP->createUser) 電子メール () がありません。
例外を表示するために PHP がこれらの通知を表示しないようにするにはどうすればよいですか?