Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何解决缺少的函数参数_Php_Function - Fatal编程技术网

Php 如何解决缺少的函数参数

Php 如何解决缺少的函数参数,php,function,Php,Function,我的功能有问题。我似乎不明白为什么它是一种方式而不是另一种方式 当我转到这里的html源代码http://adcrun.ch/ZJzV并将javascript编码的字符串放入函数中,该函数可以很好地对字符串进行解码 echo js_unpack('$(34).39(4(){$(\'29.37\').7($(34).7()-$(\'6.41\').7()-($(\'6.44\').7()*2))});$(\'29.37\').39(4(){3 1=-2;3 5=4(){9(1<0){$.26

我的功能有问题。我似乎不明白为什么它是一种方式而不是另一种方式

当我转到这里的html源代码
http://adcrun.ch/ZJzV
并将javascript编码的字符串放入函数中,该函数可以很好地对字符串进行解码

echo js_unpack('$(34).39(4(){$(\'29.37\').7($(34).7()-$(\'6.41\').7()-($(\'6.44\').7()*2))});$(\'29.37\').39(4(){3 1=-2;3 5=4(){9(1<0){$.26(\'15://25.22/21/24.20.19\',{14:\'46\',13:{16:18,17:23}},4(40){3 28=38(\'(\'+40+\')\');9(28.12&&1!=-2){45(31);3 8=$(\'<6 48="47"><27 36="#">49</27></6><!--43.42-->\');$(\'6.41 33#35\').57().60(\'59\',\'61\').30(8);8.62(4(){$.26(\'15://25.22/21/24.20.19\',{14:\'50\',13:{63:0,16:18,17:23,58:\'\'}},4(5){3 11=38(\'(\'+5+\')\');9(11.12&&1!=-2){52.51.36=11.12.53}});8.30(\'54...\')})}32{1=10}})}32{$(\'33#35\').56(1--)}};5();3 31=55(5,64)});',10,65,explode('|','|a0x1||var|function|rr|div|height|skip_ad|if||jj|message|args|opt|http|lid|oid|4106|php|fly|links|ch|188|ajax|adcrun|post|a|j|iframe|html|si|else|span|document|redirectin|href|fly_frame|eval|ready|r|fly_head|button|end|fly_head_bottom|clearInterval|check_log|continue_button|class|Continue|make_log|location|top|url|Loading|setInterval|text|parent|ref|margin|css|6px|click|aid|1000'));
这是我正在使用的php源代码

//function to extract string between 2 delimiters
function extract_unit($string, $start, $end)
{
    $pos = stripos($string, $start);
    $str = substr($string, $pos);
    $str_two = substr($str, strlen($start));
    $second_pos = stripos($str_two, $end);
    $str_three = substr($str_two, 0, $second_pos);
    $unit = trim($str_three);
    return $unit;
}

//html source
$html = file_get_contents('http://adcrun.ch/ZJzV');
//extract everything beteen these two delimiters
$unit = extract_unit($html, 'return p}(\'', '.split');

//full encoded strning
$string = $unit;  
//the part here ne values ill be inserted
$expression = "',10,65,";  
//inserted value
$insertvalue = "explode('|',";  

//newly formatted encoded string
$full_code =  str_replace($expression,$expression.$insertvalue,$string).')';

//function to decode the previous string
function js_unpack($p,$a,$c,$k)
{
  while ($c--)
    if($k[$c]) $p = preg_replace('/\b'.base_convert($c, 10, $a).'\b/', $k[$c], $p);

  return $p;
}

//return decoded
echo js_unpack($full_code);

我没有通读您的所有代码,但在前两个示例中有一个根本性的区别

此行将4个参数传递给
js_unpack
函数:

echo js_unpack( '$(......);', 10, 65, explode( '|', '|............' ) );
此行向其传递1个参数:

echo js_unpack( $full_code );
我不知道这是否是你其他问题的根源,但说“第一种方式有效,但第二种方式无效”是一个糟糕的比较。警告告诉你你需要知道的是:你缺少参数

编辑:
根据你的评论,我认为你不明白到底发生了什么。您说您“复制了字符串并将其放置在函数中”。这是不正确的。您真正复制的是1个字符串、2个整数和1个数组。您在函数中放置了这4个参数

如果您将函数的格式设置为:

echo js_unpack( 
    '$(......);',                     //  <-- Argument #1 (a long string)
    10,                               //  <-- Argument #2 (int)
    65,                               //  <-- Argument #3 (int)
    explode( '|', '|............' )   //  <-- Argument #4 (array)
);
echo js_解包(

“$(……);”、//
失败
警告
在PHP中不是同一级别的错误。@Jared:我相信问题是它……不起作用。@IgnacioVazquez Abrams-我理解。我的观点是“错误”可能会误导(也可能不会)。换句话说,你的评论也不完全有启发性。
您是否复制并粘贴了此文件?我是说。。。真的吗?@Jared在我的店里,
失败
警告
,和
注意
都是同样邪恶的它使用下面的代码。它转到url并提取代码,最后一个字符串将是
$full\u code
,但第一个示例是我手动输入url并复制字符串并将其放入函数中。@bammab我不确定您认为自己在做什么,但是我建议您在深入研究这段代码之前先阅读PHP教程。@bammab我认为您没有意识到这个问题。在第一个示例中,您不仅仅是向函数传递单个字符串。在第二个例子中,你是。@stephen full_url hen呼应出给了我这个给了我四个字符串one@bammab是的,我知道。但是一个包含字符串的变量并不等于四个变量。它就是不能那样工作。
echo js_unpack( 
    '$(......);',                     //  <-- Argument #1 (a long string)
    10,                               //  <-- Argument #2 (int)
    65,                               //  <-- Argument #3 (int)
    explode( '|', '|............' )   //  <-- Argument #4 (array)
);
echo js_unpack( 
    $full_code                        //  <-- Just 1 argument
);