I want to get a PDO Connection with data from a json config file. I currently have this, but it doesn’t work and throws a fatal PDOException error $cfg = json_decode(“../config/config.json”); $host =…
Tag: php
redirect 301 to / if url contains index.php
I have a blog in laravel 5.8 and I want to redirect 301 to / it there is index.php in the url. My .htaccess is this …
Process inputted data for JS Fetch Api request like jQuery does in Ajax request when processData is true
First of all. Code of ajax_handler.php <?php $res = $_POST; $res['response'] = 'Custom'; header('Content-Type: application/json'); echo json_encode($res); I have jQuery Ajax function with Promise …
Regex for FIGI numbers
I am trying to write some regex to match FIGI numbers. FIGI numbers have 12 characters and are built in the following structure: A two-letter prefix, excluding (BS, BM, GG, GB, GH, KY, VG) G as the …
How to display line by line a csv file in PHP with a particular structure? [closed]
I have this code that reads a csv file and displays it in this form : REFERENCE;COLOR;QUANTITY;TURNOVER;SELL TROUGH;COMMENT GJK0C9;8952;3;90;3%;Pack S GJKCS4;399;2;19;10%;Windows GSIJS5;9224;…
Debug Toolbar in Codeigniter 4 not working
I installed Codeigniter 4.0.2 and did following changes: 1- CI_ENVIRONMENT = development in .env file 2- SetEnv CI_ENVIRONMENT development in .htaccess in public folder 3- Added $useKint = true; in main index.php file in public folder When I open at localhost, welcome page is rendered but no Debug Toolbar is …
How to modify post response in php
How to modify this response $url = “https://example.com”; $data = “{“phone_number”:”18868768″}; $len = strlen($data); $headers = array(); $otp = request($url, $data, $headers); the response is {“…
login page redirect to blank page afer authentication in laravel 6
my login page redirect me to blank page with url:http://127.0.0.1:8000/login instead of the dashboard. this is my loginController <?php namespace AppHttpControllers; use IlluminateHttp…
How to handle passing an array or single value to a function
I want to make a function that accepts an array or single value as a parameter (I want foreach() to work in two cases) function handle($users) { foreach($users as $user){} } So what I’m …
PHP submit multiple forms with 1 button
I want to submit multiple forms with only 1 buttons outside all of the form. This is the index.php
…