How to generate a new GUID?

I'm working on a web service which requires a new GUID() passed as a reference to a method within the service. I am not familiar with C# or the GUID() object , but require something similar for PHP (so create a new object which from my understanding returns an empty/blank GUID ). Any ideas? You can try the following: function GUID() { if (function_exists('com_create_guid') === true

如何生成新的GUID?

我正在开发一个Web服务,它需要一个新的GUID()作为参数传递给服务中的一个方法。 我不熟悉C#或GUID() object ,但需要类似于PHP东西(因此,根据我的理解,创建一个新对象返回一个empty/blank GUID )。 有任何想法吗? 您可以尝试以下方法: function GUID() { if (function_exists('com_create_guid') === true) { return trim(com_create_guid(), '{}'); } return sprintf('%04X%04X-%04X-%04

PHP function to generate v4 UUID

So I've been doing some digging around and I've been trying to piece together a function that generates a valid v4 UUID in PHP. This is the closest I've been able to come. My knowledge in hex, decimal, binary, PHP's bitwise operators and the like is nearly non existant. This function generates a valid v4 UUID up until one area. A v4 UUID should be in the form of: xxxxxxxx-xx

PHP函数生成v4 UUID

所以我一直在做一些挖掘工作,我一直在拼凑一个可以在PHP中生成有效v4 UUID的函数。 这是我能够最接近的。 我在十六进制,十进制,二进制,PHP的按位运算符等方面的知识几乎不存在。 该功能可以生成有效的v4 UUID,直到一个区域。 v4 UUID应该采用以下形式: xxxxxxxx-xxxx- 4 xxx- y xxx-xxxxxxxxxxxx 其中y是8,9,A或B.这是函数失败的地方,因为它不遵守这个规则。 我希望在这方面有比我更多知识的人可以借我一把,

Asynchronous Socket Client Buffer Size

I have to connect a remote server with asynchronous socket connection and retrieve data. I can connect but there is a problem. Packages are sending by pieces. I have two options; I can set a buffer and get whole package in one piece or combine pieces when all transfer done. I think first option (buffer thing) is the right way. I'm defining a buffer size but it is not working in first

异步套接字客户端缓冲区大小

我必须使用异步套接字连接来连接远程服务器并检索数据。 我可以连接但有问题。 包裹是按件发送的。 我有两个选择; 我可以设置一个缓冲区,并在完成所有传输时将整个包装整件或合并为一件。 我认为第一个选项(缓冲区事件)是正确的方法。 我正在定义一个缓冲区大小,但它不适用于第一部分。 在其他部分,它的工作原理,但用这种方法,我不能整件包装在一块,因为第一部分限制在5,24 Kb。 你可以在下面找到我的代码:

Image Magic align text points based on number of text points

Is it possible to get somehow the width of a text which one draws in image magick? My current convert command looks like this: convert -size 720x480 -background #000 xc:black -fill white -stroke white -font Arial -pointsize 18 -draw "text 72,370 'NavP1'" -font Arial -pointsize 18 -draw "text , ''" -font Arial -pointsize 18 -draw "text , ''

Image Magic根据文本点的数量排列文本点

是否有可能以某种方式获得图像magick中绘制的文本的宽度? 我目前的转换命令如下所示: convert -size 720x480 -background#000 xc:black -fill white-strokes white -font Arial -pointsize 18 -draw“text 72,370'NavP1'” -font Arial -pointsize 18 -draw“text,''” -font Arial -pointsize 18 -draw“text,''” -font Arial -pointsize 18 -draw“text 370,370'Extras'” -font Ari

How to output a massive file with PHP without running out of memory

I have the code below to output a big file, but it's falling over because PHP's memory use seems to grow and grow as the file is read: <?php // various header() calls etc. $stream = fopen($tarfile,'r'); ob_end_flush(); while (!feof($stream)) { $buf = fread($stream, 4096); print $buf; flush(); unset($buf); $aa_usage = memory_get_usage(TRUE); // ← this keep

如何使用PHP输出大量文件而不会耗尽内存

我有下面的代码来输出一个大文件,但它正在下降,因为PHP的内存使用似乎随着文件被读取而增长和增长: <?php // various header() calls etc. $stream = fopen($tarfile,'r'); ob_end_flush(); while (!feof($stream)) { $buf = fread($stream, 4096); print $buf; flush(); unset($buf); $aa_usage = memory_get_usage(TRUE); // ← this keeps going up! } fclose($stream); 我曾经认为

Paypal "Log in with" integration redirect

I am integrating Login with paypal on my site but I've always the error message : Relying Party Validation error: redirect_uri provided in the request does not match with the registered redirect_uri. Please check the request. and I think that I did everything right, I've used this example : http://www.sitepoint.com/implement-user-log-paypal/ and also "www.formget.com/paypal-oaut

贝宝“登录”整合重定向

我正在将我的网站上的登录与贝宝集成在一起,但我一直都会输出错误消息: 依赖方验证错误:请求中提供的redirect_uri与注册的redirect_uri不匹配。 请检查请求。 我认为我做的都对,我已经使用了这个例子:http://www.sitepoint.com/implement-user-log-paypal/以及“www.formget.com/paypal-oauth/” 的index.php <script src="https://www.paypalobjects.com/js/external/api.js"></script> <script&g

PAYPAL:Cant to login sandbox paypal test account..!

I used the sandbox paypal url in my coding like this... form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" But i cant to login in my sandbox paypal account and how to create the sandbox paypal account. i used the following link for create an account. https://developer.paypal.com/webapps/developer/applications/accounts I want the webscr url for

PAYPAL:不能登录沙箱PayPal测试帐户..!

我在我的编码中使用了sandbox paypal网址,就像这样... form action =“https://www.sandbox.paypal.com/cgi-bin/webscr”method =“post” 但我不能登录我的沙箱PayPal帐户以及如何创建沙箱PayPal帐户。 我用以下链接创建一个帐户。 https://developer.paypal.com/webapps/developer/applications/accounts 我想要sandbox paypal帐户登录的webscr网址。

How can I insert a PHP code in CKEditor from a plugin?

I'm using Drupal 7 and the CKEditor module for a WYSIWYG textarea. I need to insert a PHP code like <?php echo "Hello World!"; ?> <?php echo "Hello World!"; ?> in the Full HTML text format, it isn't needed to see the Hello World in the WYSIWYG mode, but it has to be in the source mode. The config file sitesallmodulescontribckeditorckeditor.config.js has

我如何从插件插入一个PHP代码到CKEditor中?

我使用Drupal 7和CKEditor模块来实现所见即所得的textarea。 我需要插入一个PHP代码,如<?php echo "Hello World!"; ?> <?php echo "Hello World!"; ?>在Full HTML文本格式,它不需要看到Hello World在所见即所得的模式,但它必须是在源模式。 配置文件sitesallmodulescontribckeditorckeditor.config.js有config.protectedSource.push(/<?[sS]*??>/g); // PHP Code config.protecte

Any equivalent to subprocess in PHP?

In Java and Python, you have the ProcessBuilder or subprocess modules that let you easily start a process using unescaped strings eg ["ls", "some unescaped directory name"] - they also give you powerful tools like access to read from stdout, stderr. Is there any equivalent feature of PHP that is more intelligent and useful than just exec() ? The closest equivalent that give

任何等价于PHP中的子进程?

在Java和Python中,您可以使用ProcessBuilder或子流程模块,使您可以使用非转义字符串轻松启动流程,例如["ls", "some unescaped directory name"] - 它们还为您提供了强大的工具,如访问从stdout,stderr 。 是否有任何PHP的等价功能比只有exec()更智能和有用? 使用双向通信访问stdin , stdout和stderr的最接近的等价物是proc_open() 。 以下是文档中的示例: <?php $descriptorspec = array(

Why do I have to use the reference operator (&) in a function call?

Setup I am borrowing a function from an open source CMS that I frequently use for a custom project. It's purpose is not important to this question but if you want to know it's a simple static cache designed to reduce database queries. I can call getObject 10 times in one page load and not have to worry about hitting the database 10 times. Code A simplified version of the function

为什么我必须在函数调用中使用引用运算符(&)?

建立 我借用了一个我经常用于定制项目的开源CMS的功能。 它的目的对于这个问题并不重要,但如果你想知道它是一个简单的静态缓存,旨在减少数据库查询。 我可以在一个页面加载中调用getObject 10次,而不必担心会触发数据库10次。 码 该函数的简化版本如下所示: function &staticStorage($name, $default_value = NULL) { static $data = array(); if (isset($data[$name]) { return $data[$name]; }