A
A
Alexey Dubrovin2021-06-18 03:48:45
PHP
Alexey Dubrovin, 2021-06-18 03:48:45

Is it possible to display a stub as html when an error occurs in php?

What I do: I
connect the ability to reload to gulp using 2 plugins.

60cbec3e047a9307559488.png
gulp-connect-php - initialize the php server for gulp.
browser-sync - reboot.
Everything is working.
The essence of the problem:
If I get an error, a page is loaded without a js file (which does this magic in the plugin) standard php error handling.
How can I do something that would not break my execution on an error (does not process anything else), and I could display it on the screen?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Edward, 2021-06-18
@Drayde

https://www.php.net/manual/en/language.exceptions.php

D
Damir Shaniyazov, 2021-06-18
@shaniyazovdamir

Very strange behavior, to be honest, I still reboot with an error. That's how it is for me

var gulp         = require('gulp'),
    sass         = require('gulp-sass'),
    browserSync  = require('browser-sync')
    concat       = require('gulp-concat'),
    uglify       = require('gulp-uglifyjs'),
    autoprefixer = require('gulp-autoprefixer'),
    connectPHP   = require('gulp-connect-php');


// Обработка Sass-файлов
gulp.task('sass', function() {
    return gulp.src('web/sass/main.sass')
    .pipe(sass())
    .pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7', {cascade: true}]))
    .pipe(gulp.dest('web/css'))
    .pipe(browserSync.reload({stream: true}))
});

// Обновление PHP-файлов
gulp.task('updatePHP', function() {
    return gulp.src([
        'assets/AppAsset.php',
        'config/*.php',
        'controllers/**/*.php',
        'models/**/*.php',
        'view/**/*.php',
        'web/**/*.php'
    ])
    .pipe(browserSync.reload({stream: true}))
});

/**
 * Объединение и минимизация JS-файлов
 */
// gulp.task('oneScript', function() {
//     return gulp.src([
//         'app/libs/jquery/dist/jquery.min.js',
//         'app/libs/slick-1.8.1/slick/slick.min.js',
//         'app/libs/bootstrap4/dist/js/bootstrap.min.js',
//         'app/js/common.js'
//     ])
//     .pipe(concat('scripts.min.js'))
//     .pipe(uglify())
//     .pipe(gulp.dest('app/js'))
//     .pipe(browserSync.reload({stream: true}))
// });

// Синхронизация с браузером
gulp.task('browser-sync', function() {
    browserSync({
        notify: false,
        proxy: 'hte'
    });
});

gulp.task('watch', function() {
    //gulp.watch(['libs/**/*.min.js', 'app/js/common.js'], gulp.parallel('oneScript'));
    gulp.watch('web/sass/*.sass', gulp.parallel('sass'));
    gulp.watch(['controllers/**/*.php' ,'models/**/*.php', 'views/**/*php'], gulp.parallel('updatePHP'));
});

gulp.task('default', gulp.parallel('browser-sync', 'watch'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question