小编Nil*_*esh的帖子

如何在laravel中使函数在后台运行

我正在开发Laravel 5.0中的一个网站,并在Windows Server2012中托管.

我遇到了一个问题,即我从另一个函数A调用控制器中的函数B,我希望调用另一个函数B的函数A不等待函数B的完成.并且功能B在后台完成并独立形成用户终止页面和功能A返回.

我搜索了这个,发现这可以通过cron中的作业来实现,如windows中的作业,pcntl_fork()和laravel中的队列功能.我是初学者.

请帮忙!提前致谢.

php queue cron laravel laravel-5

9
推荐指数
1
解决办法
2万
查看次数

如何解决cURL错误60:在Facebook身份验证时,Laravel 5中的SSL证书

目前,我正在laravel5上做一个项目.

我使用socialize进行Facebook身份验证,但我得到了cURL错误,如下所述.

 RequestException in CurlFactory.php line 162:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Run Code Online (Sandbox Code Playgroud)

我在互联网上搜索并完成了以下更改,但没有帮助

  • 下载了cart.pem文件
  • 设置路径"curl.cainfo ="C:\ xampp\cacert.pem"
  • 也取消注释"extension = php_curl.dll"

我在控制器中的代码

public function fb()  
{
    return Socialize::with('facebook')->redirect();
}
public function cb()    //callback for facebook
{
    $user = Socialize::with('facebook')->user();
    var_dump($user);
}
Run Code Online (Sandbox Code Playgroud)

php ssl curl facebook laravel-5

8
推荐指数
3
解决办法
2万
查看次数

什么是片段URL以及使用它的原因

我是PHP开发的新手.

今天我偶然发现了有趣的主题URL碎片,特别是URL的"#"部分.

我搜索了它说它就像www.example.com\foo.html#bar.

但我不明白为什么需要这个"#bar".以及如何通过PHP阅读它?

php url hash fragment-identifier

7
推荐指数
1
解决办法
1万
查看次数

最糟糕的情况是找到二叉树的最大深度

这是用于查找二叉树最大深度的伪代码:

 maxDepth(Node N)

1. If Nodes is leaf node then return 0

2. Else

     (a) Get the max depth of left subtree recursively  i.e., 

          call maxDepth( N->left-subtree)

     (a) Get the max depth of right subtree recursively  i.e., 

          call maxDepth( N->right-subtree)

     (c) Get the max of max depths of left and right 

          subtrees and add 1 to it for the current node.

         max_depth = max(max dept of left subtree,  
                             max depth of right subtree) 
                             + 1
     (d) Return max_depth
Run Code Online (Sandbox Code Playgroud)

我对这个算法的最坏情况感到困惑.这个伪代码的复杂性将是O(n).这个算法的最坏情况是什么?为什么?

algorithm tree binary-tree time-complexity data-structures

2
推荐指数
1
解决办法
902
查看次数