在一个数组取值和另外的比较。
你想学php吗?
如果是刚刚接触php的话,看一下简单的教程,然后down一个列子研究一下。进步很快
你想学php吗?
如果是刚刚接触php的话,看一下简单的教程,然后down一个列子研究一下。进步很快
解决方案 »
- 求php高手帮忙~~~
- 有一条SQL 怎样能取出这条SQL WHERE 的所有字段?
- ubuntu安装ImageMagick出错
- 今天分析dede的源友,实在太失望了,
- 文件上传问题 upload_max_filesize 和 post_max_size
- The specified CGI application misbehaved by not returning a complete set of HTTP headers
- 一个与mysql数据库连接的问题
- php无法自动跳转其他页面,大家帮我看看,谢谢!
- php 4.x中有没有忽略大小写的strpos及str_replace函数?
- 网站的安全策略如何设置?
- 如何将图片存入数据库??
- 为何我的相对路径不能使用?等待中...
array_intersect() 返回一个数组,该数组包含了所有在 array1 中也同时出现在所有其它参数数组中的值。注意键名保留不变。 例子 1. array_intersect() 例子<?php
$array1 = array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
?> 这使得 $result 成为: Array
(
[a] => green
[0] => red
)
注: 两个单元仅在 (string) $elem1 === (string) $elem2 时被认为是相同的。也就是说,当字符串的表达是一样的时候。
$i="1,2,3";表article:
id name types
1 aa 1,3,5
2 bb 2,3,5
3 cc 7,8,9我列出表中
ID为1的types中含有1,3符合条件
id 为2也是的,我现在要把1,2给读取出来,怎么做?
为
$p = "find_in_set('1', type) or find_in_set('2', type) or find_in_set('3', type)"
方法是
$p = "find_in_set('".
join("', type) or find_in_set('", split(',', $i)) .
"', type)";2、执行下列sql指令
$sql = "select * from article where $p";