Skip to content
Advertisement

Tag: php

Twig accessing protected/private model variables

I have a problem with Twig, (in fact this is not really a problem but it’s disturbing to me) I have a Post model class in php and i have some protected variables (I also tried with private). To acces them I have a public function in php getMyVariable. If in my controller I try to echo the protected variable

PHP Redirect with query parameters

Let’s say I have the following URL: What I want the PHP query to do is redirect the user to the following URL: Of course, the URL should not only redirect ?user/1234 but also ?anything/343. I want to leave the url intact and only add the /test/ to it, and leave the part afterwards the same. How do I accomplish

laravel observers are not working

I am trying to listen to model events using laravel observers .The problem is when i submit my form (update or creating new records), nothing happened at all .Do i miss something ? app.php CasesManagerServiceProvider.php CasesObserver.php Cases.php Answer Ok i have found my answer . All the problem was when I added use appObserversCasesObserver; in CasesManagerServiceProvider.php instead of use AppObserversCasesObserver;

Creating a Symfony 4 Form without Database

I’m new to symfony and want to to create a simple contact form, take the submitted values and send them as an Email. I don’t want to save anything in the database. I followed the documentation on this page: https://symfony.com/doc/current/form/without_class.html I created a new page/action with the code from the page above: But this gives me an error: What am

How to check fetched result set is empty or not?

For example: AND How to check if result set is empty or not Answer Check $data variable like: If the result of SELECT query did return any data, variable $data will contain a non-empty array/object which evaluates to true, and a false-like value otherwise.

Read date value from import Excel in PHP

I’ve problem with read date value from import value (Excel) to mysql database. i’ve code as below : i tried use strtotimeto define value from excel, but i’ve problem to save it into database, if my value in excel with excel date format is 1/1/2018 (it read as 1 Jan 2018, English time format), after i used my code above,

Passive FTP connection does not work via PHP

My application connects to FTP clients that are connected to the server via VPN. So far all clients supported active PHP and the library I used went with active FTP by default, so there was no issue. Now however we have installed some new clients that don’t properly work over active PHP, so I found out that from the server

Advertisement