This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function translit($str, $val = 'en') { | |
$translit = array( | |
'а' => 'a', 'б' => 'b', 'в' => 'v', | |
'г' => 'g', 'д' => 'd', 'е' => 'e', | |
'ё' => 'yo', 'ж' => 'zh', 'з' => 'z', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//новый движок PHPNG этот движок практически такой как у facebook | |
//у facebook движок HHVM | |
// <=> == strcmp(); комбинированный оператор сравнения | |
declare(strict_types=1); // включение динамеческой типизации | |
function foo(int $int) {} | |
$test = $str ?? 'test'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function readExelFile($filepath){ | |
require_once __DIR__ . '/../classes/PHPExcel/PHPExcel.php'; //подключаем наш фреймворк | |
$ar=array(); // инициализируем массив | |
$inputFileType = PHPExcel_IOFactory::identify($filepath); // узнаем тип файла, excel может хранить файлы в разных форматах, xls, xlsx и другие | |
$objReader = PHPExcel_IOFactory::createReader($inputFileType); // создаем объект для чтения файла | |
$objPHPExcel = $objReader->load($filepath); // загружаем данные файла в объект | |
$ar = $objPHPExcel->getActiveSheet()->toArray(); // выгружаем данные из объекта в массив | |
return $ar; //возвращаем массив |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php artisan make:auth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-type: text-html charset=utf-8'); | |
require_once __DIR__ . '/vendor/autoload.php'; | |
require_once __DIR__ . '/conf.php'; | |
require_once __DIR__ . '/class/timer.class.php'; | |
require_once __DIR__ . '/class/Database.class.php'; | |
require_once __DIR__ . '/class/Sql.class.php'; | |
Timer::start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Database { | |
public $isConn; | |
protected $datab; | |
//connect db | |
public function __construct($username = "root", $password = "", $host = "localhost", $dbname = 'copart', $options = []){ | |
$this->isConn = TRUE; | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRUNCATE TABLE %TABLE_NAME% | |
INSERT IGNORE INTO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Files cron.php> | |
order deny,allow | |
allow from localhost | |
allow from youhostname | |
allow 123.45.67.89 | |
</Files> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cookie = ''; //переменная нужна для сохранения печенек | |
function pageVK($url) { | |
global $cookie; | |
$curl = curl_init($url); | |
curl_setopt($curl,CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
use Sunra\PhpSimple\HtmlDomParser; | |
$html = curl_get('https://ntschool.ru/kursyi'); | |
$dom = HtmlDomParser::str_get_html($html); | |
$courses = $dom->find('.courses-list--item-body'); |
NewerOlder