[Tutorial] How to add projects on localhost web index // Cómo añadir proyectos en el index de "localhost"
-
Adoro Laragon. Es fantástico. El trabajo que hay detrás de este proyecto es increíble.
Adjunto el index.php con el listado de proyectos para que podáis acceder a ellos desde el botón "web" de Laragon.
Dentro del index.php están las instrucciones.
Reemplaza este "index.php" en "C:\laragon\www" (o en la ubicación donde tengas Laragon en el disco).I love Laragon. It's fantastic. The work behind this project is incredible.
I attached the index.php with the list of projects for you can access them from the "web" button of Laragon.
The instructions are inside of index.php.
Replace this "index.php" in "C:\laragon\www" (or your Laragon location inside the disc).Renombra este archivo a "index.php" (sin comillas).
Rename this file to "index.php" (without quotes).
-
Nice job! I'm glad you love Laragon.
-
the download file was not here...
where can i download this file?
-
@Lethert Sorry, i don't know what happens with the file. But give me a few days and i reupload it.
-
did you found the file?
-
Let me see that file too. Looks curious.
-
<?php
if (!empty($_GET['q'])) {
switch ($_GET['q']) {
case 'info':
phpinfo();
exit;
break;
}
}$directory = DIR;
$domain = '.local';
$show_project = 'both'; // directory, domain, both
$scanned_directories = array_diff(scandir($directory), array('..', '.'));
$skip_start_with = array('.');
$skip_file_name = array('index.php', 'composer.phar');function startsWith($strings, $start_string) {
foreach ($strings as $string) {
$len_string = strlen($string);$hasString = substr($string, 0, $len_string) == substr($start_string, 0, $len_string); if ($hasString) { break; } } return $hasString;
}
function skipFile($strings, $filename) {
foreach ($strings as $string) {
$skip = $string == $filename;if ($skip) { break; } } return $skip;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Laragon</title><link href="https://fonts.googleapis.com/css?family=Karla:400" rel="stylesheet" type="text/css"> <style> html, body { height: 100%; } body { margin: 0; padding: 0; width: 100%; display: table; font-weight: 100; font-family: 'Karla'; } .container { text-align: center; display: table-cell; vertical-align: middle; } .content { text-align: center; display: inline-block; } .title { font-size: 96px; } .opt { margin-top: 30px; font-size: 150%; } a:hover { color: red; } </style> </head> <body> <div class="container"> <div class="content"> <div class="title" title="Laragon">Laragon</div> <div class="info"><br /> <?php print($_SERVER['SERVER_SOFTWARE']); ?><br/> PHP version: <?php print phpversion(); ?> <span><a title="phpinfo()" href="/?q=info">info</a></span><br/> Document Root: <?php print ($_SERVER['DOCUMENT_ROOT']); ?><br/> Laragon Docs: <a title="Getting Started" href="https://laragon.org/docs" target="_blank">Getting Started</a><br /> Database: <a title="phpMyAdmin" href="/phpmyadmin" target="_blank">phpMyAdmin</a><br /> <div class="opt"> App: </div> <a title="Laragon Upload" href="/laragon" target="_blank">Upload</a> | <a title="phpSysInfo" href="/phpsysinfo" target="_blank">phpSysInfo</a> | <a title="Memcached" href="/memcached" target="_blank">Memcached</a> | <a title="phpRedisAdmin" href="/phpredisadmin" target="_blank">phpRedisAdmin</a> | <a title="adminer" href="/adminer" target="_blank">adminer</a> <br /> </div> <div class="opt"> Project Lists </div> <?php foreach ($scanned_directories as $scanned_directory): ?> <?php if (startsWith($skip_start_with, $scanned_directory) || skipFile($skip_file_name, $scanned_directory)): ?> <?php continue ?> <?php endif; ?> <?php if (is_dir($scanned_directory)): ?> <?php if (in_array($show_project, array('directory', 'both'))): ?> <a href="<?=strtolower($scanned_directory)?>" target="_blank"><?=$scanned_directory?></a> <?php endif; ?> <?php if (in_array($show_project, array('both'))): ?> | <?php endif; ?> <?php if (in_array($show_project, array('domain', 'both'))): ?> <a href="http://<?=strtolower($scanned_directory.$domain)?>" target="_blank"><?=$scanned_directory.$domain?></a> <?php endif; ?> <?php else: ?> <a href="<?=strtolower($scanned_directory)?>" target="_blank"><?=$scanned_directory?></a> <?php endif; ?> <br> <?php endforeach; ?> </div> </div> </body>
</html>