forked from xudianyang/phpboy.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1402 lines (752 loc) · 42.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html class="theme-next use-motion theme-next-mist">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="google-site-verification" content="google93ba54ee93760f07" />
<link rel="stylesheet" type="text/css" href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5"/>
<link rel="stylesheet" type="text/css" href="/css/main.css?v=0.4.2"/>
<meta name="description" content=" PHPBoy是一个PHP相关技术博客网站,在业余时间研究PHP内核与PHP扩展开发,关注WEB后端技术架构,LINUX服务器运维,系统安全,高性能与高可用大型网站技术架构。" />
<meta name="keywords" content="PHP,WEB开发,LAMP,Linux,MySQL,Aapache,Nginx,php内核,php扩展,php源码,phpboy,web架构师,web架构设计,高性能,高可用,PHP技术博客,技术,管理" />
<link rel="shorticon icon" type="image/x-icon" href="/favicon.ico?v=0.4.2" />
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?2d4c4b9cd9f303a04c4d9c24d32f6571";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<title> PHPBoy-专注WEB架构N年 </title>
</head>
<body>
<!--[if lte IE 8]> <div style=' clear: both; height: 59px; padding:0 0 0 15px; position: relative;margin:0 auto;'> <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://7u2nvr.com1.z0.glb.clouddn.com/picouterie.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today or use other browser ,like chrome firefox safari." style='margin-left:auto;margin-right:auto;display: block;'/></a></div> <![endif]-->
<div class="container one-column
page-home
">
<div class="headband"></div>
<div id="header" class="header">
<div class="header-inner">
<h1 class="site-meta">
<span class="logo-line-before"><i></i></span>
<a href="/" class="brand">
<span class="logo">
<i class="icon-logo"></i>
</span>
<span class="site-title">PHPBoy-专注WEB架构N年</span>
</a>
<span class="logo-line-after"><i></i></span>
</h1>
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/">
<i class="menu-item-icon icon-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories">
<i class="menu-item-icon icon-categories"></i> <br />
分类
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives">
<i class="menu-item-icon icon-archives"></i> <br />
归档
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags">
<i class="menu-item-icon icon-tags"></i> <br />
标签
</a>
</li>
<li class="menu-item menu-item-github">
<a href="https://github.com/xudianyang/">
<i class="menu-item-icon icon-github"></i> <br />
Github
</a>
</li>
</ul>
</div>
</div>
<div id="main" class="main">
<div class="main-inner">
<div id="content" class="content">
<div id="posts" class="posts-expand">
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2015-06/48-ec-snapping-system-app-scenarios.html">
电商抢购秒杀系统的设计_1_应用场景分析
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2015-06-22
</span>
<span class="post-category">
| 分类于
<a href="/categories/Architecture/">Architecture</a>
</span>
<span class="post-comments-count">
|
<a href="/2015-06/48-ec-snapping-system-app-scenarios.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2015-06/48-ec-snapping-system-app-scenarios.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<h1 id="概述">概述</h1><p>所谓知已知彼,百战不殆,在开始详细介绍实战中的抢购秒杀系统时,我们了解一些抢购秒杀系统系统面临的尴尬与难点。另外需要说明一点,下面的内容都是在工作中慢慢总结得来,我们团队也是慢慢摸着石头过河,甚至最初的的架构设计并非是抢购秒杀系统。</p>
<h1 id="评估系统处理能力">评估系统处理能力</h1><p>理论基础:<a href="http://www.phpboy.net/2014-11/46-lnmp-concurrent-resource-distribution.html">LNMP的并发考虑与资源分配</a> </p>
<p>虽然有基础去评估我们应用系统的处理能力,但是电商购买的业务流程挺复杂,从登录,商品详情,购物车,填写收货地址,选择支付方式,创建订单,完成支付,以及隐含的定时服务,限购策略,库存操作,排队机制等一系列的业务逻辑,每个请求的处理时间都不一样。那么根据木桶原理,一只水桶能将多少水取决于它最短的那块木板,分析整个业务流程中最耗系统资源的请求,以此为标准为评估系统处理能力。</p>
<div class="post-more-link text-center">
<a class="btn" href="/2015-06/48-ec-snapping-system-app-scenarios.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/抢购/"> #抢购 </a>
<a href="/tags/秒杀/"> #秒杀 </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-12/47-php-session-concurent.html">
PHP session并发操作及session读写锁
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-12-24
</span>
<span class="post-category">
| 分类于
<a href="/categories/PHP/">PHP</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-12/47-php-session-concurent.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-12/47-php-session-concurent.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<p>今天我来谈谈所有的PHPer都熟悉的session。</p>
<h3 id="Case">Case</h3><p>1.示例代码中分别以files,redis储存会话数据</p>
<p>2./session/setUserFile和/session/setUserRedis设置user_name,user_id两个key,并sleep了3s</p>
<p>3./session/setLoginFile和/session/setLoginRedis设置last_time一个key</p>
<p>4./session/indexFile和/session/indexRedis模板中两个ajax请求,/session/setUserFile和/session/setUserRedis立即执行,/session/setLoginFile和/session/setLoginRedis延迟300ms,是为了模拟同一个用户,同时在两个页面(请求)修改会话数据</p>
<div class="post-more-link text-center">
<a class="btn" href="/2014-12/47-php-session-concurent.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/session-lock/"> #session lock </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-11/46-lnmp-concurrent-resource-distribution.html">
LNMP的并发考虑与资源分配
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-11-08
</span>
<span class="post-category">
| 分类于
<a href="/categories/PHP/">PHP</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-11/46-lnmp-concurrent-resource-distribution.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-11/46-lnmp-concurrent-resource-distribution.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<p>好久没有更新博客了,有些朋友感觉我消失了,哈哈。最近项目正在赶工,也是没有办法。</p>
<h3 id="在招聘中常问的一个问题">在招聘中常问的一个问题</h3><p>PHPer当被问到你的程序性能如何?程序的并发可以达到多少?程序的瓶颈在哪儿?为了满足业务需求应该购买多少台服务器?负载均衡中php应用服务器需要多少台?</p>
<p>可能这些问题在面试中会设置一个应用的场景及一些前提条件,让面试的人去设计,并提出看法建议,能够回答得很好的人还是比较少的。</p>
<p>今天我们来谈谈LNMP的并发考虑和资源分配。</p>
<div class="post-more-link text-center">
<a class="btn" href="/2014-11/46-lnmp-concurrent-resource-distribution.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/LNMP/"> #LNMP </a>
<a href="/tags/Linux/"> #Linux </a>
<a href="/tags/Nginx/"> #Nginx </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-09/45-benstalkd-protocol.html">
Beanstalkd协议中文翻译
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-09-08
</span>
<span class="post-category">
| 分类于
<a href="/categories/异步编程/">异步编程</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-09/45-benstalkd-protocol.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-09/45-benstalkd-protocol.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<p>最近有需求做全平台的定时器,业务复杂,性能要求高,<code>linux crontab</code>的方式不适用,调研一些支持定时执行的内存队列系统,其中<code>beanstalkd</code>较适合。先将其协议研究一遍,使用就不是问题了。</p>
<h3 id="总括">总括</h3><p><code>beanstalkd</code>协议基于ASCII编码运行在tcp上。客户端连接服务器并发送指令和数据,然后等待响应并关闭连接。对于每个连接,服务器按照接收命令的序列依次处理并响应。所有整型值都非负的十进制数,除非有特别声明。</p>
<h3 id="名称约定">名称约定</h3><p>所有名称必须是ASCII码字符串,即包括:</p>
<ul>
<li><strong>字母</strong> (A-Z and a-z)</li>
<li><strong>数字</strong> (0-9)</li>
<li><strong>连字符</strong> (“-“)</li>
<li><strong>加号</strong> (“+”)</li>
<li><strong>斜线</strong> (“/“)</li>
<li><strong>分号</strong> (“;”)</li>
<li><strong>点</strong> (“.”)</li>
<li><strong>美元符</strong> (“$”)</li>
<li><strong>下划线</strong> (“_”)</li>
<li><strong>括号</strong> (“<em>(</em>“ and “<em>)</em>“)</li>
</ul>
<div class="post-more-link text-center">
<a class="btn" href="/2014-09/45-benstalkd-protocol.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/beanstalkd/"> #beanstalkd </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-09/44-mac-soft-tuxera-ntfs.html">
MAC OS X Tuxera NTFS 2013.2版本下载及激活码
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-09-06
</span>
<span class="post-category">
| 分类于
<a href="/categories/Tools/">Tools</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-09/44-mac-soft-tuxera-ntfs.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-09/44-mac-soft-tuxera-ntfs.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<p>以前的版本失效了,无法写NTFS文件系统。网上找了好久都没有找到2013.02新版的激活码,在淘宝买了一个和大家分享。</p>
<p>另外,相当鄙视那些在论坛里面发附件要求登录,要求充值,要求积分下载!!!!</p>
<p>下载地址(内附激活码):<a href="http://a.phpboy.net/tuxerantfs_2013.2.zip" title="MAC OS X Tuxera 2013.2版本下载及激活码">MAC OS X Tuxera 2013.2版本下载及激活码</a></p>
<p>备份下载(内附激活码):<a href="http://pan.baidu.com/s/1gdEbILH" title="MAC OS X Tuxera 2013.2版本下载及激活码">MAC OS X Tuxera 2013.2版本下载及激活码</a></p>
<p>粘一下说明,以便让新手了解:<br>
<div class="post-more-link text-center">
<a class="btn" href="/2014-09/44-mac-soft-tuxera-ntfs.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/Tuxera-NTFS/"> #Tuxera NTFS </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-08/43-php-yaf-dispatch-segmentation-fault.html">
Yaf的Action中Dispatch导致Segmentation fault
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-08-24
</span>
<span class="post-category">
| 分类于
<a href="/categories/PHP/">PHP</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-08/43-php-yaf-dispatch-segmentation-fault.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-08/43-php-yaf-dispatch-segmentation-fault.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<p>首先,这个问题是在Yaf群偶然看到的,这些小伙儿不折腾不畅快,今天闲来,扫了一下代码,得出结论。</p>
<p>其次,另外一个观点是,工具在运用时一定要清楚其原理,不然就是自己跳坑了没有人救的。</p>
<p>先简单明了看一下,在基于Yaf的PHP代码示例:</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="php"><span class="preprocessor"><?php</span></span><br><span class="line"><span class="keyword">use</span> <span class="title">Yaf</span>\<span class="title">Dispatcher</span>;</span><br><span class="line"><span class="keyword">use</span> <span class="title">Yaf</span>\<span class="title">Controller_Abstract</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">final</span> <span class="class"><span class="keyword">class</span> <span class="title">IndexController</span> <span class="keyword">extends</span> <span class="title">Controller_Abstract</span></span><br><span class="line"></span>{</span><br><span class="line"> <span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">init</span><span class="params">()</span></span><br><span class="line"> </span>{</span><br><span class="line"> <span class="comment">// 无</span></span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">indexAction</span><span class="params">()</span></span><br><span class="line"> </span>{</span><br><span class="line"> <span class="variable">$request</span> = <span class="keyword">new</span> Yaf\Request\Simple(<span class="string">'API'</span>, <span class="string">'index'</span>, <span class="string">'index'</span>, <span class="string">'simple'</span>);</span><br><span class="line"> Dispatcher::getInstance()->dispatch(<span class="variable">$request</span>);</span><br><span class="line"> <span class="variable">$this</span>->_view->assign(<span class="string">'displayWelcome'</span>, <span class="number">1</span>);</span><br><span class="line"> <span class="variable">$this</span>->_view->assign(<span class="string">'hello'</span>, <span class="string">'hello world!'</span>);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">simpleAction</span><span class="params">()</span></span><br><span class="line"> </span>{</span><br><span class="line"> <span class="keyword">echo</span> <span class="string">'xudianyang'</span>;</span><br><span class="line"> }</span><br><span class="line">}</span></span><br></pre></td></tr></table></figure>
<div class="post-more-link text-center">
<a class="btn" href="/2014-08/43-php-yaf-dispatch-segmentation-fault.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/Yaf/"> #Yaf </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-08/42-php-tclip.html">
PHP扩展tclip调用opencv从内存中读取及解析图片
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-08-10
</span>
<span class="post-category">
| 分类于
<a href="/categories/PHP/">PHP</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-08/42-php-tclip.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-08/42-php-tclip.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<p>前两天蛮说有一个PHP扩展,tclip图片裁剪程序。</p>
<p>Tclip致力于人脸识别和图片显著性区域的识别,它与其他图片裁剪程序最大的不同之处在于,在裁剪后的图片中保留人脸和其他图片显著性区域,不过还是图片裁剪。</p>
<p>tclip这个扩展依赖开源的opencv库,百科:OpenCV的全称是:Open Source Computer Vision Library。OpenCV是一个基于(开源)发行的跨平台计算机视觉库,可以运行在Linux、Windows和Mac OS操作系统上。它轻量级而且高效——由一系列 C 函数和少量 C++ 类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法。</p>
<p>回到正题,tclip这个小程序,只用到了opencv中一小部分功能,就是图片显著性区域的识别。</p>
<p>具体的裁剪算法,不做多的研究。</p>
<p>现在的问题是,想实现从内存中通过PHP读取图片的二进制数据(这部分数据是先准备好的)传递给opencv,通过查看opencv的API文档,看到了imdecode方法,可以从内存中载入图片。那么可以解决这个问题了。</p>
<p>关于安装tclip扩展的介绍:<a href="https://github.com/exinnet/tclip" target="_blank" rel="external">https://github.com/exinnet/tclip</a></p>
<p>但是要注意的是,opencv-2.4.9应该有bug,编译不成功,另外ubuntu-14.0.4的编译安装之后调用tclip函数报错,我测试的版本是:</p>
<blockquote>
<p>centos-6.4<br>PHP-5.4.31<br>opencv-2.4.4</p>
</blockquote>
<p>我简单的修改一下tclip扩展,支持直接从内存中载入图片数据:<a href="https://github.com/xudianyang/tclip" target="_blank" rel="external">https://github.com/xudianyang/tclip</a></p>
<p>最后,虽然PHP中已经直接可以传递图片的二进制数据了,但是发现opencv源码中,也会先将二进制数据保存到一个临时文件,再读取的。并且在opencv-2.4.2版本中临时文件不会被删除,这就有点坑了。但是还是可以减少PHP的逻辑,所以支持二进制的图片数据还是有必要的。</p>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/PHP扩展开发/"> #PHP扩展开发 </a>
<a href="/tags/tclip/"> #tclip </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-08/41-vagrant-teambition.html">
vagrant介绍及搭建团队协作开发环境
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-08-02
</span>
<span class="post-category">
| 分类于
<a href="/categories/Team/">Team</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-08/41-vagrant-teambition.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-08/41-vagrant-teambition.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<h3 id="vagrant解决的问题">vagrant解决的问题</h3><p>稍微有点团队协作开发经验的程序员都应该知道团队协作开发环境是多么的重要,起初的时候,大家的开发环境是windows,mac os x,ubuntu,centos等等,我们各个程序员都是那么坚信程序在“我”的机器上是真的正常的。但是就线上就是出了问题,或者A程序员开发环境跑不起来,而且常常提交文件时,由于目录结构的差异,会导致误提交。由于开发环境的异构会导致我们浪费大量的时间去解决这些开发环境的问题。</p>
<p>所以vagrant可以解决上述的问题,可以实现开发环境的跨平台统一部署。它还可以做得:</p>
<p>1.编辑代码环境和运行、测试环境分离,代码在一个环境中编辑,运行在另外一个系统。</p>
<p>2.可以在程序多个版本自由切换,如线上、QA测试版本、当前正在开发</p>
<div class="post-more-link text-center">
<a class="btn" href="/2014-08/41-vagrant-teambition.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/vagrant/"> #vagrant </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-05/39-php-splclassloader-psr-0.html">
SplClassLoader 基于PSR-0规范的PHP C扩展的自动加载器
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-05-18
</span>
<span class="post-category">
| 分类于
<a href="/categories/PHP/">PHP</a>
</span>
<span class="post-comments-count">
|
<a href="/2014-05/39-php-splclassloader-psr-0.html#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="2014-05/39-php-splclassloader-psr-0.html"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<p>本周强迫症又犯了,本来是有想法做其他的东西,但是开始时,就想到PHP类自动按需加载的问题。</p>
<p>PHP的类自动加载器是所有PHP框架都会精心设计的一个基础构件,各种实现,五花八门。</p>
<p>另外就是目录与类名称的定义规范,只有有一定的规范才能完成自动加载。在PHP不支持命名空间时,最优雅的实现方式,是类名称和目录映射(常用下划线),有了命名空间我们可以实现更优雅的自动加载。</p>
<div class="post-more-link text-center">
<a class="btn" href="/2014-05/39-php-splclassloader-psr-0.html#more">
阅读全文 »
</a>
</div>
</div>
<div class="post-footer">
<div class="post-tags">
<a href="/tags/PHP扩展开发/"> #PHP扩展开发 </a>
<a href="/tags/SplClassLoader/"> #SplClassLoader </a>
</div>
<div class="post-eof"></div>
</div>
</div>
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
<a class="post-title-link" href="/2014-05/40-gearman-instruction.html">
Gearman调研/测试/原理分析
</a>
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2014-05-18
</span>
<span class="post-category">
| 分类于
<a href="/categories/异步编程/">异步编程</a>
</span>