jQuery调用WebMethod(PageMethod) NET2.0的方法
404
2024-03-07
<?php
$usernames = array ('Alerk', 'Mary', 'Lucy', 'Bob', 'Jack', 'John', 'Mark' );
foreach ( $usernames as $name )
{
echo $name . '<br/>';
}
?>
<?php
$numbers = range ( 0, 10 );
foreach ( $numbers as $num )
{
echo $num . '<br/>';
}
$letters = range ( 'a', 'z' );
foreach ( $letters as $letter )
{
echo $letter . '<br/>';
}
?>
<?php
//range的第三个参数表示步长
$numbers = range(1,10,2);
for($i = 0;$i<count($numbers); $i ++)
{
echo $numbers[$i].'<br/>';
}
?>
<?php
$letters = range('a','h',2);
foreach($letters as $letter)
{
echo $letter.'<br/>';
}
?>
<?php
$letters = range('a','g',2);
foreach($letters as $key => $value)
{
echo $key.'---'.$value.'<br/>';
}
?>
<?php
$numbers = range(1,10,2);
if(is_array($numbers))
{
foreach($numbers as $num)
{
echo $num.'<br/>';
}
}
else
{
echo $numbers;
}
?>
<?php
$usernames = array ('Jackie', 'Mary', 'Lucy', 'Bob', 'Mark', 'John' );
print_r ( $usernames );
?>
<?php
//初始化数组
$userages = array('Jack'=> 23,'Lucy'=>25,'Mark'=>28);
//访问数组各元素
echo $userages['Jack'].'<br/>';
echo $userages['Lucy'].'<br/>';
echo $userages['Mark'].'<br/>';
?>
<?php
//初始化数组
$ages = array('Jack'=>23);
//追加元素
$ages['Lucy']=25;
$ages['Mark']=28;
foreach($ages as $key => $value)
{
echo $key.'----'.$value.'<br/>';
}
?>
<?php
//不创建数组直接添加
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
foreach($ages as $key => $value)
{
echo $key.'----'.$value.'<br/>';
}
?>
<?php
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
foreach($ages as $key => $value)
{
echo $key.'=>'.$value.'<br/>';
}
?>
<?php
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
$a = each($ages);
print_r($a);
echo '<br/>';
$a = each($ages);
print_r($a);
echo '<br/>';
$a = each($ages);
print_r($a);
?>
<?php
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
while(!! $element = each($ages))
{
print_r($element);
echo '<br>';
}
?>
<?php
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
while(!! $element = each($ages))
{
echo $element['key'].'=>'.$element['value'];
echo '<br>';
}
?>
<?php
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
list($name,$age)= each($ages);
echo $name.'=>'.$age;
?>
<?php
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
while(!!list($name,$age)= each($ages))
{
echo $name.'=>'.$age.'<br>';
}
?>
<?php
$ages['Jack']=23;
$ages['Lucy']=25;
$ages['Mark']=28;
each($ages);
each($ages);
list($name,$age)= each($ages);
echo $name.'=>'.$age.'<br>';
//把数组重新设定到数组开始处
reset($ages);
list($name,$age)= each($ages);
echo $name.'=>'.$age.'<br>';
?>
<?php
$nums = array(1,2,3,4,5,6,5,4,3,2,1,1,2,3,4,5,6);
//返回一个不包含重复值的数组
$result = array_unique($nums);
print_r($result);
?>
Output
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 )
9. array_flip ()-- 交换数组中的键和值
<?php
$userages = array('Jack'=> 23,'Lucy'=>25,'Mark'=>28);
$ages = array_flip($userages);
print_r($ages);
?>
<?php
$produces = array(
array('apple',6,28.8),
array('pear',3,15.6),
array('banana',10,4.6)
);
echo $produces[0][0].'|'.$produces[0][1].'|'.$produces[0][2].'<br>';
echo $produces[1][0].'|'.$produces[1][1].'|'.$produces[1][2].'<br>';
echo $produces[2][0].'|'.$produces[2][1].'|'.$produces[2][2].'<br>';
?>
<?php
$produces = array (
array ('apple', 6, 28.8 ),
array ('pear', 3, 15.6 ),
array ('banana', 10, 4.6 )
);
for($i = 0; $i < count ( $produces ); $i ++)
{
for($j = 0; $j < count ( $produces [$i] ); $j ++)
{
echo '|' . $produces[$i][$j];
}
echo '<br>';
}
?>
<?php
$produces = array (
array ('name' => 'apple', 'amount' => 6, 'price' => 28.8 ),
array ('name' => 'pear', 'amount' => 3, 'price' => 15.6 ),
array ('name' => 'banana', 'amount' => 10, 'price' => 4.6 )
);
while(!!List($key,$value)=each($produces))
{
while(!!list($key2,$value2)=each($value))
{
echo '|'.$key2.'=>'.$value2;
}
echo '<br>';
}
?>
<?php
$produces = array (
array ('name' => 'apple', 'amount' => 6, 'price' => 28.8 ),
array ('name' => 'pear', 'amount' => 3, 'price' => 15.6 ),
array ('name' => 'banana', 'amount' => 10, 'price' => 4.6 )
);
foreach($produces as $key1 => $value1)
{
foreach($value1 as $key2 => $value2)
{
echo '|'.$key2.'=>'.$value2;
}
echo '<br>';
}
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('lemo','banana','apple','pear');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
sort($fruits);
echo '排序后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('柠檬','香蕉','苹果','梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
sort($fruits);
echo '排序后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('a'=>'柠檬','b'=>'香蕉','c'=>'苹果','d'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
asort($fruits);
echo '排序后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('b'=>'柠檬','a'=>'香蕉','d'=>'苹果','c'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
ksort($fruits);
echo '排序后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('柠檬','香蕉','苹果','梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
rsort($fruits);
echo '排序后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('a'=>'柠檬','b'=>'香蕉','c'=>'苹果','d'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
arsort($fruits);
echo '排序后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('a'=>'柠檬','b'=>'香蕉','c'=>'苹果','d'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
krsort($fruits);
echo '排序后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('a'=>'柠檬','b'=>'香蕉','c'=>'苹果','d'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
shuffle($fruits);
echo '打乱后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('a'=>'柠檬','b'=>'香蕉','c'=>'苹果','d'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
$fruits = array_reverse($fruits);
echo '反转后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('a'=>'柠檬','b'=>'香蕉','c'=>'苹果','d'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
array_unshift($fruits,'?{子');
echo '插入后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array('a'=>'柠檬','b'=>'香蕉','c'=>'苹果','d'=>'梨子');
echo '原始的数组:';
print_r($fruits);
echo '<br/>';
array_shift($fruits);
echo '移出后的数组:';
print_r($fruits);
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array ('柠檬', '香蕉', '苹果', '梨子' );
echo '原始的数组:';
print_r ( $fruits );
echo '<br/>';
$newArr_key = array_rand ( $fruits, 2 );
echo '随机后的数组:';
echo $fruits [$newArr_key [0]].' ';
echo $fruits [$newArr_key [1]];
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array ('柠檬', '香蕉', '苹果', '梨子' );
echo '原始的数组:';
print_r ( $fruits );
echo '<br/>';
array_pop ( $fruits );
echo '弹出后的数组:';
print_r ( $fruits );
?>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
$fruits = array ('柠檬', '香蕉', '苹果', '梨子' );
echo '原始的数组:';
print_r ( $fruits );
echo '<br/>';
array_push ( $fruits,'?{子');
echo '弹出后的数组:';
print_r ( $fruits );
?>
<?php
$fruits = array ('柠檬', '香蕉', '苹果', '梨子' );
print_r ( $fruits );
echo '<br/>';
echo 'each() : ';
print_r ( each ( $fruits ) );
echo '<br/>';
echo 'current() : ';
echo (current ( $fruits ));
echo '<br/>';
echo 'next() : ';
echo (next ( $fruits ));
echo '<br/>';
echo 'end() : ';
echo (end ( $fruits ));
echo '<br/>';
echo 'prev() : ';
echo (prev ( $fruits ));
echo '<br/>';
echo 'pos() : ';
echo (pos ( $fruits ));
echo '<br/>';
?>
<?php
$nums = array (1, 3, 5, 1, 3, 4, 5, 65, 4, 2, 2, 1, 4, 4, 1, 1, 4, 1, 5, 4, 5, 4 );
echo count ( $nums );
echo '<br>';
echo sizeof ( $nums );
echo '<br>';
$arrayCount = array_count_values ( $nums );
print_r ( $arrayCount );
?>
<?php
$fruits = array('a'=>'apple','b'=>'banana','o'=>'orange');
extract($fruits);
echo $a.'<br>';
echo $b.'<br>';
echo $o.'<br>';
?>
#免责声明#
本站[绿夏技术导航]提供的一切软件、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络收集整理,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序或内容,请支持正版,购买注册,得到更好的正版服务。我们非常重视版权问题,如有侵权请邮件[admin@lxwl520.com]与我们联系进行删除处理。敬请谅解!