unlink

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Deletes a file
<?php unlink(string $filename, ?resource $context = null): bool
<?php     {

        $tmp = __DIR__ . '/_runtime_components.json';



        file_exists($tmp) && unlink($tmp);

    }



    public function setUp(): void
<?php     {

        $tmp = __DIR__ . '/_runtime_components.json';



        file_exists($tmp) && unlink($tmp);

    }



    function breakIntoATinkerShell($browsers, $e)
<?php         foreach ($paths as $path) {

            try {

                if (@unlink($path)) {

                    clearstatcache(false, $path);

                } else {

                    $success = false;
<?php         $laravel = new Application(getcwd());



        if (is_file($configPath = $laravel->getCachedConfigPath())) {

            @unlink($configPath);

        }



        if (is_file($servicesPath = $laravel->getCachedServicesPath())) {
<?php         }



        if (is_file($servicesPath = $laravel->getCachedServicesPath())) {

            @unlink($servicesPath);

        }



        if (is_file($packagesPath = $laravel->getCachedPackagesPath())) {
<?php         }



        if (is_file($packagesPath = $laravel->getCachedPackagesPath())) {

            @unlink($packagesPath);

        }

    }

}
<?php     public function handle()

    {

        if (is_file($servicesPath = $this->laravel->getCachedServicesPath())) {

            @unlink($servicesPath);

        }



        if (is_file($packagesPath = $this->laravel->getCachedPackagesPath())) {
<?php         }



        if (is_file($packagesPath = $this->laravel->getCachedPackagesPath())) {

            @unlink($packagesPath);

        }



        $this->components->info('Compiled services and packages files removed successfully.');
<?php             $this->laravel->maintenanceMode()->deactivate();



            if (is_file(storage_path('framework/maintenance.php'))) {

                unlink(storage_path('framework/maintenance.php'));

            }



            $this->laravel->get('events')->dispatch(new MaintenanceModeDisabled());
<?php     public function deactivate(): void

    {

        if ($this->active()) {

            unlink($this->path());

        }

    }
<?php         return tap($view->render(), function () use ($view, $deleteCachedView) {

            if ($deleteCachedView) {

                @unlink($view->getPath());

            }

        });

    }
<?php         $this->assertFalse($disk->writeStream('path.txt', $handle));

        fclose($handle);



        unlink(__DIR__.'/../../my-custom-path/path.txt');

        rmdir(__DIR__.'/../../my-custom-path');

    }
<?php             $this->assertEquals('private', $scoped->getVisibility('dirname/filename.txt'));

        } finally {

            unlink(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt');

            rmdir(__DIR__.'/../../to-be-scoped/path-prefix/dirname');

            rmdir(__DIR__.'/../../to-be-scoped/path-prefix');

            rmdir(__DIR__.'/../../to-be-scoped');
<?php             $this->assertTrue(is_dir(__DIR__.'/../../to-be-scoped/path-prefix'));

            $this->assertEquals(file_get_contents(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt'), 'file content');

        } finally {

            unlink(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt');

            rmdir(__DIR__.'/../../to-be-scoped/path-prefix/dirname');

            rmdir(__DIR__.'/../../to-be-scoped/path-prefix');

            rmdir(__DIR__.'/../../to-be-scoped');
<?php         putenv('ARTISAN_DOCS_OPEN_STRATEGY='.__DIR__.'/fixtures/open-strategy.php');

        $this->app[Kernel::class]->registerCommand($this->command()->setUrlOpener(null));



        @unlink($GLOBALS['open-strategy-output-path']);



        $this->artisan('docs installation')

            ->expectsOutputToContain('Opening the docs to: https://laravel.com/docs/8.x/installation')