(перевод, оригинал)
Поиграть с разметкой Markdown можно на демо-странице.
(перевод, оригинал)
Поиграть с разметкой Markdown можно на демо-странице.
<?php | |
function json_sort(string $json, bool $objects=true, bool $arrays=false): string | |
{ | |
// uses a recursive lambda | |
$order = null; | |
$order = function ($json) use (&$order, $objects, $arrays) { | |
// sort sub-trees | |
foreach ($json as $key => $value) { | |
if (is_array($value) || is_object($value)) { |
$tmpFile = $sourceFileName; | |
$fileName = $this->csvFilePath . DIRECTORY_SEPARATOR . $this->csvFileName; | |
$command = 'xls2csv -c\; -q0 -s cp1251 -d cp1251 ' . $tmpFile . ' > ' . $fileName; | |
exec($command); | |
unlink($tmpFile); |
protected function getFilename(UploadedFile $file): string | |
{ | |
$hash = sha1_file($file->tempName); | |
$name = substr_replace($hash, '/', 3, 0); | |
$name = substr_replace($name, '/', 7, 0); | |
return $name . DIRECTORY_SEPARATOR . $file->extension; | |
} |
Как удалить любую папку, в т.ч. и .idea, и лишние файлы из Git | |
Создаем файл .gitignore в корне репозитария с содержимым: | |
.idea | |
logs/ | |
------------------------------------------------------------------ | |
Подробнее можно ознакомиться на странице: https://git-scm.com/book/ru/v1/Основы-Git-Запись-изменений-в-репозиторий | |
Удаляем ненужные папки и файлы при синхронизации в Git репозиторий |
$dataArr = [ | |
0 => 'EF001391', | |
1 => 'EF000228', | |
2 => 'EF000227', | |
]; | |
$debug_log = Yii::app()->runtimePath . '/DebugExport.log'; | |
$dataErr = print_r($dataArr, true); | |
file_put_contents($debug_log, $dataErr . PHP_EOL, FILE_APPEND); | |
================================ |
/** | |
* Преобразует SimpleXMLElement в array | |
* @param SimpleXMLElement $xml | |
* @return array | |
*/ | |
private static function xmlToArray($xml) { | |
$xml = (array) $xml; | |
if(empty($xml)) { | |
return null; |
# frontend | |
server { | |
listen 80; | |
server_name yii2.lo; | |
server_tokens off; | |
client_max_body_size 128M; | |
charset utf-8; | |
access_log /var/log/nginx/yii2-access.log main buffer=50k; |
Docker compose is a tool that is used for defining and running multi-container Docker apps in an easy way.
It provides docker-compose.yml
configuration file that can be used to bring up an app and the suite of services it depends on
with just one command.
docker-compose up
- start all services from docker-compose.yml
docker-compose up db
- start only service db
docker-compose up --build
- rebuild all images and run containersdocker-compose -f docker-compose.prod.yml up
- start all services from docker-compose.prod.yml