php get_defined_vars,PHP: get_defined_vars - Manual

Here is a function which generates a debug report for display or email

using get_defined_vars. Great for getting a detailed snapshot without

relying on user input.

// Usage: generateDebugReport(method,get_defined_vars(),email[optional]);

// Where method is "browser" or "email".

// Create an ignore list for keys returned by 'get_defined_vars'.

// For example, HTTP_POST_VARS, HTTP_GET_VARS and others are

// redundant (same as _POST, _GET)

// Also include vars you want ignored for security reasons - i.e. PHPSESSID.$ignorelist=array("HTTP_POST_VARS","HTTP_GET_VARS","HTTP_COOKIE_VARS","HTTP_SERVER_VARS","HTTP_ENV_VARS","HTTP_SESSION_VARS","_ENV","PHPSESSID","SESS_DBUSER","SESS_DBPASS","HTTP_COOKIE");$timestamp=date("m/d/y h:m:s");$message="Debug report created$timestamp\n";// Get the last SQL error for good measure, where $link is the resource identifier

// for mysql_connect. Comment out or modify for your database or abstraction setup.global$link;$sql_error=mysql_error($link);

if($sql_error){$message.="\nMysql Messages:\n".mysql_error($link);

}// End MySQL

// Could use a recursive function here. You get the idea ;-)foreach($defined_varsas$key=>$val){

if(is_array($val) && !in_array($key,$ignorelist) &&count($val) >0){$message.="\n$keyarray (key=value):\n";

foreach($valas$subkey=>$subval){

if(!in_array($subkey,$ignorelist) && !is_array($subval)){$message.=$subkey." = ".$subval."\n";

}

elseif(!in_array($subkey,$ignorelist) &&is_array($subval)){

foreach($subvalas$subsubkey=>$subsubval){

if(!in_array($subsubkey,$ignorelist)){$message.=$subsubkey." = ".$subsubval."\n";

}

}

}

}

}

elseif(!is_array($val) && !in_array($key,$ignorelist) &&$val){$message.="\nVariable ".$key." = ".$val."\n";

}

}

if($method=="browser"){

echonl2br($message);

}

elseif($method=="email"){

if($email=="undefined"){$email=$_SERVER["SERVER_ADMIN"];

}$mresult=mail($email,"Debug Report for ".$_ENV["HOSTNAME"]."",$message);

if($mresult==1){

echo"Debug Report sent successfully.\n";

}

else{

echo"Failed to send Debug Report.\n";

}

}

}?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面是我 运行终端代码后的返回,请帮我解释下:shenhaibo@bogon webAssembly % emcc add.c -s WASM=1 -o add.wasm wasm-ld: error: /opt/homebrew/Cellar/emscripten/3.1.40/libexec/cache/sysroot/lib/wasm32-emscripten/libstandalonewasm-nocatch.a(__main_void.o): undefined symbol: main emcc: error: '/opt/homebrew/Cellar/emscripten/3.1.40/libexec/llvm/bin/wasm-ld -o add.wasm /var/folders/hd/zkctfvz128366gcjfw9pgslr0000gn/T/emscripten_temp_0gmz58hs/add_0.o -L/opt/homebrew/Cellar/emscripten/3.1.40/libexec/cache/sysroot/lib/wasm32-emscripten /opt/homebrew/Cellar/emscripten/3.1.40/libexec/cache/sysroot/lib/wasm32-emscripten/crt1.o -lGL -lal -lhtml5 -lstandalonewasm-nocatch -lstubs-debug -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /var/folders/hd/zkctfvz128366gcjfw9pgslr0000gn/T/tmp6m8wb6r0libemscripten_js_symbols.so --strip-debug --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export-table -z stack-size=65536 --initial-memory=16777216 --max-memory=16777216 --stack-first' failed (returned 1) shenhaibo@bogon webAssembly %
06-07

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值