小编som*_*ove的帖子

php中数组的右旋转

例如我有一个数组

$a = [1,2,3,4,5]; 
Run Code Online (Sandbox Code Playgroud)

由此$a,如何获取最后一个数组并将其设置为第一个[5,1,2,3,4] ,以及如何获取最后两个数组以使其像[4,5,1,2,3]

php arrays

5
推荐指数
2
解决办法
1697
查看次数

Laravel 传递参数

我的 Laravel 应用程序有一些问题。我正在尝试制作刮刀,它看起来像这样。

<?php

namespace App\Http\Controllers;

use App\Scraper\Amazon;
use Illuminate\Http\Request;

class ScraperController extends Controller
{
    public $test;

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $this->test = new Amazon();
       
        return $this->test;
    }
Run Code Online (Sandbox Code Playgroud)

如您所见,我在应用程序中创建了名为 Scraper 的新文件夹,我有 Amazon.php 文件,如下所示:

<?php

namespace App\Scraper;

use Goutte\Client;

class Amazon
{
    public string $test = ''; 

    public function __construct()
    {
        return "test";
    }

    public function index()
    {
        $client = new Client();
        
        $crawler = $client->request('GET', 'https://www.amazon.co.uk/dp/B002SZEOLG/');

        $crawler->filter('#productTitle')->each(function ($node) …
Run Code Online (Sandbox Code Playgroud)

php laravel

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

标签 统计

php ×2

arrays ×1

laravel ×1