我在我的PC上安装了Apache 2.4和PHP 5.6(使用Windows 10).
启用Xdebug后PHP运行速度比没有Xdebug慢10倍(!).
这是php.ini配置:
zend_extension = "php_xdebug-2.3.3-5.6-vc11-x86_64.dll"
xdebug.remote_autostart = 0
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "C:\PHP\tmp"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_mode=req
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
xdebug.trace_output_dir = "C:\PHP\tmp"
xdebug.auto_trace = 0
xdebug.var_display_max_depth = 3
xdebug.remote_connect_back = 0
Run Code Online (Sandbox Code Playgroud)
我确保禁用了探查器和自动启动.有谁知道这种行为的原因是什么?
var User = $resource(
'http://test/index.php'
);
var user = User.get({id:'1'});
// GET: http://test/index.php?id=1
// server returns: { "login":"foo", "name":"bar", "mail":"baz" }
user.name = "qux";
user.$save();
// POST: http://test/index.php?id=1
// server returns: { "login":"foo", "name":"bar", "mail":"qux"}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,当您调用save()用户对象时,属性将被来自服务器的属性替换.
但如果服务器响应如下:
{
"errors":{
"login":"too short",
"name":"is already using that name.",
"mail":"invalid email."
}
}
Run Code Online (Sandbox Code Playgroud)
将覆盖用户对象属性,而是会出现包含这些错误的属性错误.
有没有办法改变行为$resource?我想检查响应的状态,并在此基础上决定是更新对象的属性还是向用户报告错误.
除了第一个后面的数字之外,如何从字符串中删除所有逗号:
输入: ",123,,,456,789,,,00,"
输出: "123,45678900"
我试过这种方法:
str.replace(/(.*,.*)(,)(.*)/g ,"$1$3");
Run Code Online (Sandbox Code Playgroud)
但它无法正常工作.