【问题标题】:Is there a way to show unknown name and value variable in php code?有没有办法在 php 代码中显示未知的名称和值变量?
【发布时间】:2014-10-03 08:52:36
【问题描述】:

我有一个带有变量的 file1.php。变量名称未知。 file1.php 使用 ZendGuard 5 加密。所以我无法查看代码。 在 file1.php 中包含 file2.php。我不知道包含 file2.php 的位置,因为 file1.php 已加密。有没有办法在 php 代码中显示未知名称变量?

例子:

file1.php(它将使用 ZendGuard 5 加密)

$my_secret_variable='Hi stackoverflow!';
$my_other_secret_variable_SOME_RANDOM_A4Nf8d3ET='Hi stack!';
include ('file2.php');

file2.php(未加密) 让我们尝试猜测秘密变量的名称和值。

//first attempt
echo'$my_secret';
//second attempt
echo'$my_secret_var';
//etc

有没有办法在 php 代码中显示未知的名称和值变量?

【问题讨论】:

  • 我不太确定您要做什么,但我认为 php 中的 $$ 可能会有所帮助? here
  • 为什么要在echo() 中引用变量名? (更不用说你实际上用单引号做错了)......

标签: php security zend-guard


【解决方案1】:

你可以试试get_defined_vars:

$all = get_defined_vars();

print_r($all);

【讨论】:

  • Khalid Dabjan,我尝试在 php 代码中隐藏我的“秘密”变量的名称和值。
猜你喜欢
  • 2023-01-17
  • 2011-10-22
  • 1970-01-01
  • 2022-10-02
  • 1970-01-01
  • 2020-08-29
  • 2020-03-04
  • 2016-10-02
  • 2012-06-23
相关资源
最近更新 更多