TOP ▲ itcore TOPTIPSphp_redeclare.php  タグ:php エラー

PHP 関数2重定義エラー対策 | itcore 2019年

エラー

Fatal error: Cannot redeclare uForm() (previously declared in xxx) xxx

対策

// フォーム変数の受け取り
if (!function_exists('uForm')) {
 function uForm($var) {
  if (isset($_POST[$var])) return $_POST[$var];
  if (isset($_GET[$var])) return $_GET[$var];
  return "";
 }
}