在我的Laravel代码中,当我在代码中的某处处理记录时,我正在向数组中添加新属性(例如$ obj-> newAttr = someContent),稍后当我dd()对象时它向我显示两个数组:# attributes和#original,但新创建的属性仅显示在#attributes数组中.
这是一个例子,当我dd()对象时,我得到了#attributes数组:
#attributes: array:21 [?
"field_name" => "229"
"company_name" => "Maya Dairy"
"seeding_rate" => 115
"id" => 11
"property_id" => 71
"acreage" => "73.80"
"status" => "current"
"dairy_crop_variety_id" => 19
"field_weight" => "1432.39"
"moisture" => "67.00"
"starch" => null
"yield_id" => 50
"crop" => "Wheat: <strong>Sumit 515</strong> @ <strong>21.3 T/c</strong>"
"variety" => "Sumit 515"
"planted_at" => "Nov 10, 2016"
"harvested_at" => "May 1, 2017"
"crop_age" => 172
"cropDateLink" => "Harvested: <a href="#" data-toggle="modal" data-target="#editRowCrop" data-id="11" …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 vultr 的 Ubuntu 22.04 服务器上安装 LEMP。\n我可以安装 Nginx sudo apt install -y nginx- 没问题。
但是当我尝试通过运行这些命令安装 php8.0 时
\nsudo apt install software-properties-common\nsudo add-apt-repository ppa:ondrej/php\nsudo apt-get update\nRun Code Online (Sandbox Code Playgroud)\n我不断收到错误The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release' does not have a Release file.
sudo add-apt-repository ppa:ondrej/php这是运行命令后得到的结果
root@ubuntu:~# sudo add-apt-repository ppa:ondrej/php\nPPA publishes dbgsym, you may need to include 'main/debug' component\nRepository: 'deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main'\nDescription:\nCo-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of …Run Code Online (Sandbox Code Playgroud) 我想在每个空间将文本消息拆分为数组。在我收到这条短信之前,它一直工作得很好。\n以下是处理文本字符串的几行代码:
\n\n $str = \'T bw4\xc2\xa0\xc2\xa005/09/19 07:51 am BW6N 499.803\';\n $cleanStr = iconv("UTF-8", "ISO-8859-1", $str);\n $strArr = preg_split(\'/[\\s\\t]/\', $cleanStr);\n var_dump($strArr);\nRun Code Online (Sandbox Code Playgroud)\n\nVar_dump 产生以下结果:
\n\narray:6 [\xe2\x96\xbc\n 0 => "T"\n 1 => b"bw4 05/09/19"\n 2 => "07:51"\n 3 => "am"\n 4 => "BW6N"\n 5 => "499.803"\n]\nRun Code Online (Sandbox Code Playgroud)\n\n数组“1 => b”bw4 05/09/19”中的 #1 项不正确,我无法弄清楚数组值前面的字母“b”是什么。\n此外,空格(es) 在“bw4”和“05/09/19”之间\n任何关于如何更好地实现字符串分割的建议都非常感谢。\n这是原始字符串: https://3v4l.org/2L35M,这是来自我的本地主机的结果图像:http://prntscr.com/jjbvny
\n