V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  hpze2000  ›  全部回复第 1 页 / 共 3 页
回复总数  42
1  2  3  
2017-07-26 17:14:51 +08:00
回复了 hpze2000 创建的主题 PHP 这个能否改成递归, 并在指定层级退出循环
@xqin 这些值都是动态的, 没有一个是明确的,而且层级也不确定 你这样不合适。
2017-07-26 16:24:42 +08:00
回复了 hpze2000 创建的主题 PHP 这个能否改成递归, 并在指定层级退出循环
设计是无限极,由客户端参数产生, 但是也没有 那么深的层次, 主要是只能用递归来实现逻辑
@littleylv 恩, 可以使用,谢谢
2017-07-26 15:28:55 +08:00
回复了 hpze2000 创建的主题 PHP 这个能否改成递归, 并在指定层级退出循环
@littleylv 确实不行, 我想要的是在 "2017-06-09" - 1 - 1 这层停止, 但是打印出来的结果还有再下一层的数据,  loop($dataArr, 1, 2); 是这样调用你代码吧?
2017-07-26 12:24:11 +08:00
回复了 hpze2000 创建的主题 PHP 这个能否改成递归, 并在指定层级退出循环
@littleylv 不行, 数据结构是上面那种
2017-07-26 12:23:42 +08:00
回复了 hpze2000 创建的主题 PHP 这个能否改成递归, 并在指定层级退出循环
``` json
{"2017-06-09":{"1":{"1":{"1009":[["2017-06-09","1","1","1009","58950.0"]],"1013":[["2017-06-09","1","1","1013","56313.0"]],"1014":[["2017-06-09","1","1","1014","28712.0"]],"1018":[["2017-06-09","1","1","1018","28066.0"]],"1019":[["2017-06-09","1","1","1019","21876.0"]],"1024":[["2017-06-09","1","1","1024","1726.0"]]},"2":{"1009":[["2017-06-09","1","2","1009","155460.0"]],"1013":[["2017-06-09","1","2","1013","161308.0"]],"1014":[["2017-06-09","1","2","1014","85232.0"]],"1018":[["2017-06-09","1","2","1018","76618.0"]],"1019":[["2017-06-09","1","2","1019","86616.0"]],"1024":[["2017-06-09","1","2","1024","20397.0"]]},"3":{"1009":[["2017-06-09","1","3","1009","37313.0"]],"1013":[["2017-06-09","1","3","1013","21614.0"]],"1014":[["2017-06-09","1","3","1014","31182.0"]],"1018":[["2017-06-09","1","3","1018","32203.0"]],"1019":[["2017-06-09","1","3","1019","25704.0"]],"1024":[["2017-06-09","1","3","1024","4950.0"]]},"4":{"1009":[["2017-06-09","1","4","1009","13948.0"]],"1013":[["2017-06-09","1","4","1013","13140.0"]],"1014":[["2017-06-09","1","4","1014","6991.0"]],"1018":[["2017-06-09","1","4","1018","10775.0"]],"1019":[["2017-06-09","1","4","1019","7691.0"]],"1024":[["2017-06-09","1","4","1024","736.0"]]},"5":{"1009":[["2017-06-09","1","5","1009","344285.0"]],"1013":[["2017-06-09","1","5","1013","280339.0"]],"1014":[["2017-06-09","1","5","1014","237754.0"]],"1018":[["2017-06-09","1","5","1018","223571.0"]],"1019":[["2017-06-09","1","5","1019","219879.0"]],"1024":[["2017-06-09","1","5","1024","25673.0"]]},"6":{"1009":[["2017-06-09","1","6","1009","96828.0"]],"1013":[["2017-06-09","1","6","1013","103464.0"]],"1014":[["2017-06-09","1","6","1014","49379.0"]],"1018":[["2017-06-09","1","6","1018","62153.0"]],"1019":[["2017-06-09","1","6","1019","39691.0"]],"1024":[["2017-06-09","1","6","1024","5976.0"]]}},"2":{"1":{"1009":[["2017-06-09","2","1","1009","573576.0"]],"1013":[["2017-06-09","2","1","1013","558571.0"]],"1014":[["2017-06-09","2","1","1014","323552.0"]],"1018":[["2017-06-09","2","1","1018","304721.0"]],"1019":[["2017-06-09","2","1","1019","320235.0"]],"1024":[["2017-06-09","2","1","1024","50228.0"]]},"2":{"1009":[["2017-06-09","2","2","1009","97358.0"]],"1013":[["2017-06-09","2","2","1013","84935.0"]],"1014":[["2017-06-09","2","2","1014","57710.0"]],"1018":[["2017-06-09","2","2","1018","37856.0"]],"1019":[["2017-06-09","2","2","1019","59515.0"]],"1024":[["2017-06-09","2","2","1024","12598.0"]]},"3":{"1009":[["2017-06-09","2","3","1009","14631.0"]],"1013":[["2017-06-09","2","3","1013","15582.0"]],"1014":[["2017-06-09","2","3","1014","12144.0"]],"1018":[["2017-06-09","2","3","1018","12527.0"]],"1019":[["2017-06-09","2","3","1019","14618.0"]],"1024":[["2017-06-09","2","3","1024","1859.0"]]},"4":{"1009":[["2017-06-09","2","4","1009","8131.0"]],"1013":[["2017-06-09","2","4","1013","3090.0"]],"1014":[["2017-06-09","2","4","1014","7888.0"]],"1018":[["2017-06-09","2","4","1018","7041.0"]],"1019":[["2017-06-09","2","4","1019","5873.0"]],"1024":[["2017-06-09","2","4","1024","1054.0"]]},"5":{"1009":[["2017-06-09","2","5","1009","197357.0"]],"1013":[["2017-06-09","2","5","1013","168221.0"]],"1014":[["2017-06-09","2","5","1014","141942.0"]],"1018":[["2017-06-09","2","5","1018","159086.0"]],"1019":[["2017-06-09","2","5","1019","145580.0"]],"1024":[["2017-06-09","2","5","1024","16738.0"]]},"6":{"1009":[["2017-06-09","2","6","1009","11851.0"]],"1013":[["2017-06-09","2","6","1013","8199.0"]],"1014":[["2017-06-09","2","6","1014","7198.0"]],"1018":[["2017-06-09","2","6","1018","6964.0"]],"1019":[["2017-06-09","2","6","1019","5844.0"]],"1024":[["2017-06-09","2","6","1024","-151.0"]]}}}}
```
2017-07-26 11:32:31 +08:00
回复了 hpze2000 创建的主题 PHP 这个能否改成递归, 并在指定层级退出循环
function loop($data) {
if (!is_array($data)) return;

foreach ($data as $key1 => $da1) {
echo $key1 . ": " . count($da1) . "\n";
loop($da1);

// 这样递归, 怎么在 第三层的时候跳出 总共可能有 10 层
}
}
2017-07-26 11:12:06 +08:00
回复了 hpze2000 创建的主题 PHP 这个能否改成递归, 并在指定层级退出循环
foreach ($dataArr as $key1 => $da1) {
echo 'lay1 * ' . $key1 . ": " . count($da1) . "\n";
foreach ($da1 as $key2 => $da2) {
echo 'lay2 * ' . $key2 . ": " . count($da2) . "\n";
foreach ($da2 as $key3 => $da3) {
echo 'lay3 * ' . $key3 . ": " . count($da3) . "\n";

// 可能有无限极, 能在指定层这里跳出循环
}
}
}
这种云测试, 是怎么实现的 ?
2015-06-08 16:22:45 +08:00
回复了 skyline75489 创建的主题 分享创造 Deck —— 使用 React Native 实现的 Github 客户端
楼主 这个坑帮我看看啥问题。
$ react-native init AwesomeProject
This will walk you through creating a new React Native project in /Users/johnson/AwesomeProject
npm WARN engine [email protected]: wanted: {"node":"~0.10"} (current: {"node":"0.12.4","npm":"2.10.1"})

[email protected] install /Users/johnson/AwesomeProject/node_modules/react-native/node_modules/ws
(node-gyp rebuild 2> builderror.log) || (exit 0)

初始化项目的时候, 一直卡在那, 是需要翻墙么??
还是一样的错误, 无奈啊。。
@breeswish
@df4VW
谢谢, 稍后试试, 上午先上班。
@yangg 谢谢, 参考下 ,有些 E文 有些吃力
@ksky 问题是, 如果还没安装微信呢 ? 这么让他弹出提醒 先安装 微信?
@Ricepig 哦这样, 那如果是安卓里面 有没有思路?
@Ricepig 浏览器插件,不对吧, 我觉得是写入自己的协议,
但是, 没安装之前, 是如何判断, 提示 要先安装我们的软件 ,这个不懂如何实现。
问题补充, 如果是 安卓下 又如何实现。。
2013-10-30 16:56:06 +08:00
回复了 hpze2000 创建的主题 程序员 求一个PHP正则 字符串处理
@shiny OK 谢谢
@Livid 这是什么意思?
额, 代理IP 这么搞???
@Showfom
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2821 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 11:48 · PVG 19:48 · LAX 03:48 · JFK 06:48
Developed with CodeLauncher
♥ Do have faith in what you're doing.