显示下拉菜单

Test of http_build_query() 本页面仅提供英文版本。

Example #1 : test success
Example #2 : test success
Example #3 : test success
Example #4 : test success
Example #5 : test success
Example #6 : test success
Example #1
$input = [
  
=> [
    
'foo' => 'bar',
    
'baz' => 'boom',
    
'cow' => 'milk',
    
'php' => 'hypertext processor',
  ],
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'string' => 'foo=bar&baz=boom&cow=milk&php=hypertext+processor',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #2
$input = [
  
=> [
    
'foo' => 'bar',
    
'baz' => 'boom',
    
'cow' => 'milk',
    
'php' => 'hypertext processor',
  ],
  
=> '',
  
=> '&',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'string' => 'foo=bar&baz=boom&cow=milk&php=hypertext+processor',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #3
$input = [
  
=> [
    
=> 'foo',
    
=> 'bar',
    
=> 'baz',
    
=> 'boom',
    
'cow' => 'milk',
    
'php' => 'hypertext processor',
  ],
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'string' => '0=foo&1=bar&2=baz&3=boom&cow=milk&php=hypertext+processor',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #4
$input = [
  
=> [
    
=> 'foo',
    
=> 'bar',
    
=> 'baz',
    
=> 'boom',
    
'cow' => 'milk',
    
'php' => 'hypertext processor',
  ],
  
=> 'myvar_',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'string' => 'myvar_0=foo&myvar_1=bar&myvar_2=baz&myvar_3=boom&cow=milk&php=hypertext+processor',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #5
$input = [
  
=> [
    
'user' => [
      
'name' => 'Bob Smith',
      
'age' => 47,
      
'sex' => 'M',
      
'dob' => '5/12/1956',
    ],
    
'pastimes' => [
      
=> 'golf',
      
=> 'opera',
      
=> 'poker',
      
=> 'rap',
    ],
    
'children' => [
      
'bobby' => [
        
'age' => 12,
        
'sex' => 'M',
      ],
      
'sally' => [
        
'age' => 8,
        
'sex' => 'F',
      ],
    ],
    
=> 'CEO',
  ],
  
=> 'flags_',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'string' => 'user%5Bname%5D=Bob+Smith&user%5Bage%5D=47&user%5Bsex%5D=M&user%5Bdob%5D=5%2F12%2F1956&pastimes%5B0%5D=golf&pastimes%5B1%5D=opera&pastimes%5B2%5D=poker&pastimes%5B3%5D=rap&children%5Bbobby%5D%5Bage%5D=12&children%5Bbobby%5D%5Bsex%5D=M&children%5Bsally%5D%5Bage%5D=8&children%5Bsally%5D%5Bsex%5D=F&flags_0=CEO',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #6
$input = [
  
=> [
    
'foo' => 'bar',
    
'baz' => 'boom',
    
'cow' => 'milk',
    
'php' => 'hypertext processor',
  ],
  
=> NULL,
  
=> '&',
  
=> 'PHP_QUERY_RFC3986',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'string' => 'foo=bar&baz=boom&cow=milk&php=hypertext%20processor',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]