Php expecting end of file

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in laravel 5.4 and it’s not duplicated [duplicate]

So, guys, this is the error I am getting in my project. Parse error: syntax error, unexpected end of the file, expecting function (T_FUNCTION) or const (T_CONST) https://i.stack.imgur.com/n2Tf0.jpg code for video model:-

 @extends('layouts.app') @section('content') 
>">
@endsection
public function video()< $categories= \App\Category::all(); return view('admin.video') ->with("categories",$categories); > public function addVideo(Request $request)< $un= new \App\Video; $un->custom_name= $request->get('vid_name'); $un->vid_id= $request->get('vid_id'); $un->category= $request->get('category'); $un->feature_status="0"; $un->status="1"; $un->save(); if($un)< return redirect()->back(); > > 

so guys I think i added all the code which is needed to know the error of my project. other thing is that when I remove category option from video form it works perfect. I don’t know now that if it’s error in my code or it’s relationship error in models. please help. Thanks in advance

Источник

Ошибка «unexpected end of file» в PHP. В чем причина?

У меня работал код, все было отлично. Но вчера бот отказался работать, а ошибку выдает такую:
Parse error: syntax error, unexpected end of file in /var/www/www-root/data/www/botfrombot3.site/app/controllers/madeline.php on line 145

Не могу понять ошибку, ведь раньше он работал стабильно и без нареканий, а тут резко какую-то ошибку выбил.

 if (!\defined('MADELINE_ALLOW_COMPOSER') && \class_exists(\Composer\Autoload\ClassLoader::class)) < throw new \Exception('Composer autoloader detected: madeline.php is incompatible with Composer, please require MadelineProto using composer.'); >\define('MADELINE_PHP', __FILE__); class Installer < const RELEASE_TEMPLATE = 'https://phar.madelineproto.xyz/release%s?v=new'; const PHAR_TEMPLATE = 'https://github.com/danog/MadelineProto/releases/latest/download/madeline%s.phar?v=%s'; /** * Phar lock instance. * * @var resource|null */ private static $lock = null; /** * Installer lock instance. * * @var resource|null */ private $lockInstaller = null; /** * PHP version. * * @var string */ private $version; /** * Constructor. */ public function __construct() < if ((PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION < 7) < throw new \Exception('MadelineProto requires at least PHP 7.1 to run'); >if (PHP_INT_SIZE < 8) < throw new \Exception('A 64-bit build of PHP is required to run MadelineProto, PHP 8.0+ recommended.'); >$backtrace = \debug_backtrace(0); if (\count($backtrace) === 1) < if (isset($GLOBALS['argv']) && !empty($GLOBALS['argv'])) < $arguments = \array_slice($GLOBALS['argv'], 1); >elseif (isset($_GET['argv']) && !empty($_GET['argv'])) < $arguments = $_GET['argv']; >else < $arguments = []; >if (\count($arguments) >= 2) < \define(\MADELINE_WORKER_TYPE::class, \array_shift($arguments)); \define(\MADELINE_WORKER_ARGS::class, $arguments); >else < die('MadelineProto loader: you must include this file in another PHP script, see https://docs.madelineproto.xyz for more info.'.PHP_EOL); >\define('MADELINE_REAL_ROOT', \dirname($backtrace[0]["file"])); > $this->version = (string) \min(81, (int) (PHP_MAJOR_VERSION.PHP_MINOR_VERSION)); \define('MADELINE_PHAR_GLOB', \getcwd().DIRECTORY_SEPARATOR."madeline*-version>.phar"); \define('MADELINE_RELEASE_URL', \sprintf(self::RELEASE_TEMPLATE, $this->version)); > /** * Destructor. */ public function __destruct() < if ($this->lockInstaller) < \flock($this->lockInstaller, LOCK_UN); \fclose($this->lockInstaller); $this->lockInstaller = null; > > /** * Extract composer package versions from phar. * * @param string|null $release * @return array */ private static function extractVersions($release) < $phar = "madeline-$release.phar"; $packages = ['danog/madelineproto' =>'old']; if (!\file_exists("phar://$phar/vendor/composer/installed.json")) < return $packages; >$composer = \json_decode(\file_get_contents("phar://$phar/vendor/composer/installed.json"), true) ?: []; if (!isset($composer['packages'])) < return $packages; >foreach ($composer['packages'] as $dep) < $name = $dep['name']; if (\strpos($name, 'phabel/transpiler') === 0) < $name = \explode('/', $name, 3)[2]; >$version = $dep['version_normalized']; if ($name === 'danog/madelineproto' && \substr($version, 0, 2) === '90') < $version = \substr($version, 2); >$packages[$name] = $version; > return $packages; > /** * Report installs to composer. * * @param string $local_release * @param string $remote_release * * @return void */ private static function reportComposer($local_release, $remote_release) < $previous = self::extractVersions($local_release); $current = self::extractVersions($remote_release); $postData = ['downloads' =>[]]; foreach ($current as $name => $version) < if (isset($previous[$name]) && $previous[$name] === $version) < continue; >$postData['downloads'][] = [ 'name' => $name, 'version' => $version ]; > if (\defined('HHVM_VERSION')) < $phpVersion = 'HHVM '.HHVM_VERSION; >else

Средний 4 комментария

Источник

Синтаксическая ошибка, неожиданный конец файла в PHP-коде

Моя ошибка:

Parse error: syntax error, unexpected end of file in the line

Мой код:

function login()

// код функции логина

>

if (login())

Добро пожаловать, администратор

Загрузка файлов

Редактирование подсчета очков

Else

echo «Недопустимый логин. Попробуйте еще раз»;

>

?>

Некоторый HTML код

В чем проблема?

Ответ 1

Вам следует избегать этого (в конце вашего кода):

или этого:

Не следует ставить скобки непосредственно рядом с php тегом открытия/закрытия и разделять его пробелом:

также избегайте ”

Ответ 2

У меня была такая же ошибка, но я исправил ее, изменив файл php.ini . Откройте его в своем любимом редакторе.

Найдите свойство short_open_tag и примените следующее изменение:

; short_open_tag = Off ; предыдущее значение

short_open_tag = On ; новое значение

Ответ 3

Есть два разных метода обойти ошибки синтаксического анализа.

Метод 1 (ваш файл PHP)

Избегайте в вашем файле PHP этого:

?>

Убедитесь, что вы поставили это так:

Ваш код содержит ” ”

ПРИМЕЧАНИЕ: Отсутствует php после ”

Метод 2 (файл php.ini)

Также есть простой способ решить вашу проблему. Найдите значение свойства short_open_tag (откройте в текстовом редакторе с помощью Ctrl + F !) И примените следующее изменение:

; short_open_tag = Off

Замените на:

short_open_tag = On

Согласно описанию основных директив php.ini, short_open_tag позволяет использовать короткий открытый тег (

Некоторый HTML код

Мы будем очень благодарны

если под понравившемся материалом Вы нажмёте одну из кнопок социальных сетей и поделитесь с друзьями.

Источник

Parse error:syntaxerror,unexpected end of file, expecting function (T_FUNCTION) for class-oembed.php

I got strange error suddenly and my website is down. Even i cant login to wordpress admin account . here is error :

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) in /home/Myid/public_html/Mywebsite/wp-includes/class-oembed.php on line 191

I logged in to my host account filemanager to edit file and only i found on line 191 is this : «* @param string $provider The URL» Please help how to fix this. Few line up coding as follows :

// Fetch URL content if ( $html = wp_remote_retrieve_body( wp_safe_remote_get( $url ) ) ) < /** * Filter the link types that contain oEmbed provider URLs. * * @since 2.9.0 * * @param array $format Array of oEmbed link types. Accepts 'application/json+oembed', * 'text/xml+oembed', and 'application/xml+oembed' (incorrect, * used by at least Vimeo). */ $linktypes = apply_filters( 'oembed_linktypes', array( 'application/json+oembed' =>'json', 'text/xml+oembed' => 'xml', 'application/xml+oembed' => 'xml', ) ); // Strip $html = substr( $html, 0, stripos( $html, '' ) ); // Do a quick check $tagfound = false; foreach ( $linktypes as $linktype => $format ) < if ( stripos($html, $linktype) ) < $tagfound = true; break; >> if ( $tagfound && preg_match_all( '/]+)>/i', $html, $links ) ) < foreach ( $links[1] as $link ) < $atts = shortcode_parse_atts( $link ); if ( !empty($atts['type']) && !empty($linktypes[$atts['type']]) && !empty($atts['href']) ) < $providers[$linktypes[$atts['type']]] = $atts['href']; // Stop here if it's JSON (that's all we need) if ( 'json' == $linktypes[$atts['type']] ) break; >> > > // JSON is preferred to XML if ( !empty($providers['json']) ) return $providers['json']; elseif ( !empty($providers['xml']) ) return $providers['xml']; else return false; > /** * Connects to a oEmbed provider and returns the result. * * @param string $provider The URL 

Источник

Читайте также:  Program using files in cpp
Оцените статью