Print return of a class in another class in PHP

1

How could I print the return of the $ formData variable in a class in PHP?

function location_form_handler($formData) // Use a different function name for each form
{
    $formName = 'General'; // change this to your form's name
    $fieldName = 'carrera'; // change this to your field's name
    $newFieldName = $fieldName . '_carrera';
    return form_with_pipes_handler($formName, $fieldName, $newFieldName, $formData);
}

function my_custom_function($cf7) {

$req_dump = print_r($_REQUEST, TRUE);
$fp = fopen('request.log', 'a');
fwrite($fp, $req_dump);
fclose($fp);

}

I would like to print the value of $ formData in the request.log. How could I do it?

Thanks

    
asked by Rolly Chin 06.08.2017 в 06:47
source

1 answer

0

You can print the value of a variable to a file from any part of PHP with file_put_contents () :

function location_form_handler($formData) {
    // Guardamos el valor de $formData en request.log
    file_put_contents('request.log', $formData, FILE_APPEND);

    $formName = 'General'; // change this to your form's name
    $fieldName = 'carrera'; // change this to your field's name
    $newFieldName = $fieldName . '_carrera';
    return form_with_pipes_handler($formName, $fieldName, $newFieldName, $formData);
}
    
answered by 06.08.2017 в 08:35