<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="beaker" viewBox="214.7 0 182.6 792">
<!-- <path>s and whatever other shapes in here -->
</symbol>
<symbol id="shape-icon-2" viewBox="0 26 100 48">
<!-- <path>s and whatever other shapes in here -->
</symbol>
</svg>
<svg class="icon">
<use xlink:href="#shape-icon-1" />
</svg>
<svg class="icon">
<use xlink:href="#shape-icon-2" />
</svg>
fill: black
и т. д.). Замечу, что атрибут viewBox для символов нужно задавать обязательно, что-бы картинки правильно масштабировались (например если вы будете изменять их размеры). %CD%
cmd.exe /c c:\users\user\Desktop\file.bat
%SystemRoot%\System32
.cd /d "%~dp0"
%~
доступны в описании команд call и for. <?php
enum CurrenciesEnum: string
{
case RUB = 'RUB';
case USD = 'USD';
case EUR = 'EUR';
case GBP = 'GBP';
case JPY = 'JPY';
case CNY = 'CNY';
private const DATA = [
'RUB' => ['name' => 'Рублей', 'short' => '₽', 'ratio' => 1, 'default' => 1, 'display' => 1],
'USD' => ['name' => 'Dollar', 'short' => '$', 'ratio' => 1, 'default' => 1, 'display' => 1],
'EUR' => ['name' => 'Euro', 'short' => '€', 'ratio' => 1, 'default' => 1, 'display' => 1],
'GBP' => ['name' => 'Pound', 'short' => '£', 'ratio' => 1, 'default' => 1, 'display' => 1],
'JPY' => ['name' => '円', 'short' => '¥', 'ratio' => 1, 'default' => 1, 'display' => 1],
'CNY' => ['name' => '元', 'short' => 'Ұ', 'ratio' => 1, 'default' => 1, 'display' => 1],
];
public function code(): string
{
return $this->value;
}
public function name(): string
{
$this->insureValue();
return self::DATA[$this->value]['name'];
}
public function short(): string
{
$this->insureValue();
return self::DATA[$this->value]['short'];
}
public function ratio(): string
{
$this->insureValue();
return self::DATA[$this->value]['ratio'];
}
public function default(): string
{
$this->insureValue();
return self::DATA[$this->value]['default'];
}
public function display(): string
{
$this->insureValue();
return self::DATA[$this->value]['display'];
}
private function insureValue(): void
{
if (!isset(self::DATA[$this->value])) {
throw new InvalidArgumentException($this->value);
}
}
}
echo CurrenciesEnum::RUB->code(), PHP_EOL;
echo CurrenciesEnum::RUB->name(), PHP_EOL;
echo CurrenciesEnum::RUB->short(), PHP_EOL;
<?php
enum CurrenciesEnum
{
case RUB;
case USD;
case EUR;
case GBP;
case JPY;
case CNY;
public function code(): string
{
return $this->name;
}
public function name(): string
{
return self::getField($this->name, 'name');
}
public function short(): string
{
return self::getField($this->name, 'short');
}
public function ratio(): string
{
return self::getField($this->name, 'ratio');
}
public function default(): string
{
return self::getField($this->name, 'default');
}
public function display(): string
{
return self::getField($this->name, 'display');
}
private static function getField(string $currency, string $field): string
{
$data = [
self::RUB->name => ['name' => 'Рублей', 'short' => '₽', 'ratio' => 1, 'default' => 1, 'display' => 1],
self::USD->name => ['name' => 'Dollar', 'short' => '$', 'ratio' => 1, 'default' => 1, 'display' => 1],
self::EUR->name => ['name' => 'Euro', 'short' => '€', 'ratio' => 1, 'default' => 1, 'display' => 1],
self::GBP->name => ['name' => 'Pound', 'short' => '£', 'ratio' => 1, 'default' => 1, 'display' => 1],
self::JPY->name => ['name' => '円', 'short' => '¥', 'ratio' => 1, 'default' => 1, 'display' => 1],
self::CNY->name => ['name' => '元', 'short' => 'Ұ', 'ratio' => 1, 'default' => 1, 'display' => 1],
];
if (!isset($data[$currency])) {
throw new InvalidArgumentException($currency);
}
return $data[$currency][$field];
}
}
echo CurrenciesEnum::RUB->code(), PHP_EOL;
echo CurrenciesEnum::RUB->name(), PHP_EOL;
echo CurrenciesEnum::RUB->short(), PHP_EOL;
final class Currency
{
public function __construct(
readonly string $code,
readonly string $name,
readonly string $short,
readonly int $ratio = 1,
readonly int $default = 1,
readonly int $display = 1,
)
{
}
}
final class CurrenciesStorage
{
private static self|null $instance = null;
/** @var Currency[] */
private array $currencies = [];
private function __construct()
{
}
public static function getInstance(): self
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
public function add(Currency $currency): void
{
$this->currencies[$currency->code] = $currency;
}
public function has(string $code): bool
{
return isset($this->currencies[$code]);
}
public function get(string $code): Currency|null
{
return $this->currencies[$code] ?? null;
}
public function all(): array
{
return $this->currencies;
}
}
$storage = CurrenciesStorage::getInstance();
$storage->add(new Currency('RUB', 'Рублей', '₽'));
$storage->add(new Currency('USD', 'Dollar', '$'));
$storage->add(new Currency('EUR', 'Euro', '€'));
// Получить данные по одному объекту
echo $storage->get('RUB')->code, PHP_EOL;
echo $storage->get('RUB')->name, PHP_EOL;
echo $storage->get('RUB')->short, PHP_EOL;
// Получить все объекты
var_dump($storage->all());
<?php
return [
'db' => [
'host' => '127.0.0.1',
'port' => 3306,
'db' => 'pizza',
'user' => 'root',
'pass' => '',
'charset' => 'utf8mb4',
]
];
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$db = new mysqli(
$config['db']['host'],
$config['db']['user'],
$config['db']['pass'],
$config['db']['db'],
$config['db']['port']
);
$db->set_charset($config['db']['charset']);
$db->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);
.
<select id="single" class="form-control" name = '1234' >
<option value="" disabled selected style='display:none;'>выберите тип</option>
<?php foreach($types as $object): ?>
<option value ="<?=$object['id']?>"><?=$object['name']?></option>
<?php endforeach ?>
</select>
<?php
$config = require 'config.php';
require 'mysqli.php';
$sql="SELECT * FROM pizza";
$types=$db->query($sql)->fetch_all(MYSQLI_ASSOC);
include 'pizza.tpl.php';
В каком форуме можно предложить разработчикам эту идею?
<base ... />
в контейнере <head>
<FilesMatch "\.(ttf|woff)$">
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, OPTIONS"
</FilesMatch>
// Создаете функцию
function myFunc() {
console.log('Функция сработала');
}
// Добавляете слушателя событий к нужному элементу
document.querySelector('div').addEventListener('click', myFunc);
// Клик по первому диву в разметке
// Или ко всем
document.querySelectorAll('div').map(item => item.addEventListener('click', myFunc);)
// Клик по любому диву в разметке
<svg>
<!-- Градиент -->
<linearGradient id="linear-gradient">
<stop offset="0%" stop-color="gold"/>
<stop offset="100%" stop-color="teal"/>
</linearGradient>
<!-- Фигура с градиентной заливкой -->
<rect fill="url(#linear-gradient)"
width="100%" height="100%"/>
</svg>
var _ajaxLoaded = $('ul > li').length;
function checkLoaded(){
if(--_ajaxLoaded <= 0){
//все аяксы выполнены
}else{
//Осталось выполнить _ajaxLoaded аяксов...
}
}
....done(function(data){
/*...*/
checkLoaded();
});