java array to string_数组到字符串转换(Array to string conversion)
数组到字符串转换(Array to string conversion)
这段代码有什么问题? 我不明白。 这是错误代码:
注意:第12行的C:\ xampp \ htdocs \ stage \ ripper.php中的数组到字符串转换数组块引用
注意:第13行数组中C:\ xampp \ htdocs \ stage \ ripper.php中的数组到字符串转换
header('Content-Type: text/html; charset=utf-8');
$url = "http://www.asaphshop.nl/epages/asaphnl.sf/nl_NL/ObjectPath=/Shops/asaphnl/Products/80203122";
$htmlcode = file_get_contents($url);
$pattern = "/itemprop=\"description\"\>(.*)\(.*)\
Taal:(.*)\(.*)\>(.*)\\(.*)\data-src-l\/sU";
preg_match_all($pattern, $htmlcode, $matches);
Print_r ($matches);
$description =($matches[1]);
$language = ($matches[3]);
echo $description;
echo $language
?>
What's the problem of this code? I don't get it. This is the error code:
Notice: Array to string conversion in C:\xampp\htdocs\stage\ripper.php on line 12 Array Blockquote
Notice: Array to string conversion in C:\xampp\htdocs\stage\ripper.php on line 13 Array
header('Content-Type: text/html; charset=utf-8');
$url = "http://www.asaphshop.nl/epages/asaphnl.sf/nl_NL/ObjectPath=/Shops/asaphnl/Products/80203122";
$htmlcode = file_get_contents($url);
$pattern = "/itemprop=\"description\"\>(.*)\(.*)\
Taal:(.*)\(.*)\>(.*)\\(.*)\data-src-l\/sU";
preg_match_all($pattern, $htmlcode, $matches);
Print_r ($matches);
$description =($matches[1]);
$language = ($matches[3]);
echo $description;
echo $language
?>
原文:https://stackoverflow.com/questions/26377015
更新时间:2020-02-29 18:37
最满意答案
当您使用preg_match_all , $matches是一个二维数组。 所以$matches[1]和$matches[3]都是数组。 echo仅适用于数字或字符串,因此当您尝试回显数组时会收到警告。 如果要查看其中的内容,请使用print_r()或var_dump() :
print_r($description);
print_r($language);
When you use preg_match_all, $matches is a 2-dimensional array. So $matches[1] and $matches[3] are both arrays. echo only works with numbers or strings, so you get a warning when you try to echo an array. If you want to see what's in them, use print_r() or var_dump():
print_r($description);
print_r($language);
2014-10-15
相关问答
对我来说似乎完全合法; char *[3]衰变为char ** ,所以赋值应该是有效的。 GCC 4.4.5和CLang 1.1都没有抱怨。 Seems perfectly legal to me; char *[3] decays to char **, so the assignment should be valid. Neither GCC 4.4.5 nor CLang 1.1 complains.
要开始你的作业, String.split将正则表达式分割字符串,此表达式可能是一个空字符串: String[] ary = "abc".split("");
产生数组: (java.lang.String[]) [, a, b, c]
摆脱空的第一个条目留给读者练习:-) 注意:在Java 8中,不再包含空的第一个元素。 To start you off on your assignment, String.split splits strings on a regular expressi
...
serialize数据:
然后反unserialize : <?php
$youralldata = unserialize($_POST['data']);
print_r($youralldata);
?>
serialize the data:
...
the_given_string.scan(/"(.*?)"/).flatten
the_given_string.scan(/"(.*?)"/).flatten
$list = array ($_POST["array"]);
如果$_POST['array']已经是一个数组, Array($_POST['array'])将产生[一个]数组字符串数组。 如果你写print_r($list) ,你会看到类似这样的东西: Array(0 =>
Array(
0 => "0",
1 => "0",
2 => "0",
3 => "0",
4 => "0",
5 => "0",
6 => "0",
7 => "0
...
你在char[]上调用toString并继承Object的实现,所以你得到了char[].class名字,然后是对象的哈希。 相反,调用String(char[])构造函数: nid_txt.setText(new String(emp.nid));
You're calling toString on a char[] - and that inherits the implementation from Object, so you get the char[].class name, @
...
你只需要使用正确的字符串连接。 改变这一行: echo "";
对于其中一个选项: echo "";
echo "";
希望能帮助到你。 You just need to use proper string concatenation. Change
...
您收到错误,因为$pages是一个数组。 看起来你想要吐出该数组中的项目数,在这种情况下你应该用count($pages)替换$pages 。 echo '
', $prevlink, ' Page ', $page, ' of ',
count($pages), ' pages, displaying ', $start, '-', $end, ' of ', count($total),
'results ', $nextlink,
...
当您使用preg_match_all , $matches是一个二维数组。 所以$matches[1]和$matches[3]都是数组。 echo仅适用于数字或字符串,因此当您尝试回显数组时会收到警告。 如果要查看其中的内容,请使用print_r()或var_dump() : print_r($description);
print_r($language);
When you use preg_match_all, $matches is a 2-dimensional array. So $
...
你这样做: echo'
(line 248) '.$ids = array();
基本上,您不能将数组与字符串连接,这就是出现错误的原因。 要修复错误,可以将数组声明分隔为单独的行: echo'
$ids = array();
希望这可以帮助! You're doing this: echo'
(line 248) '.$ids = array();
Basically, you can'
...
java array to string_数组到字符串转换(Array to string conversion)相关推荐
- java中字符串和数组如何比较_[Java教程]javascript中数组和字符串的方法比较
[Java教程]javascript中数组和字符串的方法比较 0 2016-07-19 23:00:05 ×目录[1]可索引 [2]转换 [3]拼接[4]创建[5]位置 前面的话 字符串和数组有很多的 ...
- java集合——集合与数组间的转换+算法
[0]README 0.1) 本文描述转自 core java volume 1, 源代码为原创,旨在理解 java集合--集合与数组间的转换+算法 的相关知识: 0.2) for full sour ...
- .NET 数组之间进行转换 Array.ConvertAll
数组是引入类型 // 编译成功string[] sz = { "a", "a", "a" };object[] oz = sz;// 编译失 ...
- 1200/1500PLC字符数组与字符串转换FB块
1200/1500PLC系统块里没有发现字符数组转换成字符串和字符串转换成字符数组指令,所以自己用SCL语言开发了一个标准FB块,具体的代码如下,需要源码加我qq584472557 1.字符数组转字符 ...
- 字符数组、字节数组、字符串转换
字符串string和内存流MemoryStream及比特数组byte[]互转比较 定义string变量为str,内存流变量为ms,比特数组为bt 1.字符串转比特数组 (1)byte[] bt=Sys ...
- MATLAB 数值数组和字符串转换
函数名 可实现的功能 函数名 可实现的功能 num2str 数字转换为字符串 str2num 字符串转换为数字 int2str 整数转换为字符串 sprintf 将格式数据写为字符串 mat2str ...
- java 字符串 字节数组_字符串到字节数组,字节数组到Java中的字符串
java 字符串 字节数组 Today we will learn how to convert String to byte array in java. We will also learn ho ...
- java 字符串转数组、数组转字符串、List转数组、数组转List
java 字符串转数组.数组转字符串.List转数组.数组转List 总结了几种使用jdk中的方法对字符串进行转换(不包含第三方jar包),主要涉及:字符串转数组.数组转字符串.List转数组.数组转 ...
- php键值字符串转数组,PHP数组与字符串互相转换实例
PHP 数组转字符串,与字符串转数组 $array = array('lastname', 'email', 'phone'); $comma_separated = implode(",& ...
最新文章
- 21个UI设计必会的设计技巧
- 32岁程序员面试被拒:比又穷又忙更可怕的,是2020年你还不懂...
- sql instr()与LOCATE()字符串查找函数
- echo 和 var_dump
- KickStart 无人值守安装系统
- Exchange Server 2013预览版服务器角色概况
- LiveVideoStack线上分享第三季(十一):Xilinx视频解决方案
- Android播放外部音乐文件
- gravatar配置和使用【让你的网站使用全球通用头像】
- 3月2日 ESC CAN 比特率 波特率 带宽与容量 香农定理 奈奎斯特定理 信噪比
- TensorFlow入门:Feed和Fetch
- Xshell连接FTP服务器
- win7需要计算机管理员权限,解决方案:Win7安装软件需要管理员权限解决方案
- 文件夹的菜单栏和地址栏不见了
- win10笔记本电脑键盘没反应是哪个键锁了
- pt-diskstats 报错 Can't locate Time/HiRes.pm in @INC
- Redis基本使用|基本命令|redis事务|Jedis|持久化|订阅|集群|
- 大咖云集,从1到N,第十二届中国IDC产业年度大典集锦
- rust旋转摆放_Rust | 种植房教程(新版) - Tamura77
- 信息竞赛:DEV C++常用技巧
热门文章
- Leet Code OJ 326. Power of Three [Difficulty: Easy]
- 01.search_api_综述
- 【GIF动画+完整可运行源代码】C++实现 冒泡排序——十大经典排序算法之一
- linux-时间日期类
- [Leetcode总结] 98.验证二叉搜索树
- (*长期更新)软考网络工程师学习笔记——Linux操作系统中的vi/vim 编辑器详解
- 计算机网络实验(华为eNSP模拟器)——第五章 单臂路由
- linux fstream open,fstream创建文件的问题
- java吧王者_java单排上王者!(一) java内存
- 按钮开始多线程_微软MR技术专家分享:AR/VR多线程处理的八年经验与技巧