Skip to content

Regex pluck parts too, not whole string

This is my input content: and this is regex example: This is the $matches content: Not bad, but I’d like somehow to pick “add_to_cart” and “product_name” as well. I can do it with explode() function, but wonder if there is a way to do this by regex only once. Also, I wonder if it…

How redirect from /file.php to /file on nginx?

I’m currently hiding the .php extension from the urls on my nginx server with this configuration: This is working perfectly, but how can I make nginx not allow adding the .php extension?. In my example if you manually delete the .php it works but if you add it it remains permanent in the url. Answer To …

How do I send files(images) in an array in PHP via ajax?

Mistake https://i.stack.imgur.com/mtsAP.png However, if you enter just: It shows everything correctly https://i.stack.imgur.com/kNptA.png PHP Answer From the console output in the second image it appears that fileList is an array of File objects. As such you should append them to a FormData object and set tha…

Too few arguments to function php

my controller { } ?> my model { } app.php it shows this error Fatal error: Uncaught ArgumentCountError: Too few arguments to function product::index(), 0 passed in C:xampphtdocshermesmvccoreapp.php on line 40 and exactly 1 expected in C:xampphtdocshermesmvccontrollsproduct.php:14 Stack trace: #0 C:xampphtd…

How to read a excel file with merged cells in php?

I wrote a php script that allows me to read an uploaded excel file and insert all the images contained in a folder by renaming them with the cell values “style” and “color” to have style_color.jpg. The script works fine but if I upload an xlsx file containing merged cells like this: im…