Используя встроенную функцию списка, вы можете сделать это
a
out:[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]
#Displaying the list
a.remove(a[0])
out:[[1, 1, 1, 1], [1, 1, 1, 1]]
# Removed the first element of the list in which you want altered number
a.append([5,1,1,1])
out:[[1, 1, 1, 1], [1, 1, 1, 1], [5, 1, 1, 1]]
# append the element in the list but the appended element as you can see is appended in last but you want that in starting
a.reverse()
out:[[5, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]
#So at last reverse the whole list to get the desired list
Хорошо, я наконец понял, что случилось. Мой сервер разработки React работает на
157.230.176.243:3001
, и мой CakePHP API работал на этом же сервере,
157.230.176.243
Мне не нравится, что я передаю полный URL-адрес API на вызов fetch()
. Я переключил свой код React на
url: "/users/register.json"
, и он работает нормально.