17 октября 2014
Нет комментариев
Для удаления всех скриптов из текста:
preg_replace('#<script(.*?)>(.*?)</script>#is','',$text);
Для удаления всех скриптов из текста:
preg_replace('#<script(.*?)>(.*?)</script>#is','',$text);
Аналог header(‘Location: ‘.$arResult[‘ITEMS’][0][‘DETAIL_PAGE_URL’])
localredirect($arResult['ITEMS'][0]['DETAIL_PAGE_URL'],false,"301 Moved permanently");
Вернет только уникальные массивы из многомерного.
$objects=array_map("unserialize",array_unique(array_map("serialize",$objects)));
http://webtypo.blogspot.ru/2012/11/arrayunique.html
require "FGetCSV.php"; $content=file_get_contents($f); if(($handle=fopen("php://memory","r+"))!==FALSE){ fputs($handle,$content); rewind($handle); while($data=File_FGetCSV::fgetcsv($handle,65536,";")) { print_r($data); } }
Скачать: FGetCSV
http://forum.dklab.ru/viewtopic.php?p=200945
$abc=array(); $range=range(192,223); foreach($range as $letter) { $abc[]=chr($letter); } print_r($abc);
http://www.kobzarev.com/programming/print-cyrillic-alphabet.html
$abc=array(); foreach(range(chr(0xC0),chr(0xDF)) as $letter) { $abc[]=iconv('CP1251','UTF-8',$letter); } print_r($abc);
http://www.kobzarev.com/programming/print-cyrillic-alphabet.html
javascript:
$(document).ready(function(){ var session; var secpic=document.getElementById('secpic'); $.ajaxSetup({cache:false}) $.get('gs.php',{requested:'captcha'},function (data) { session=data; secpic.value=$.trim(session); }); });
php:
session_start(); if (isset($_GET['requested'])) { print $_SESSION[$_GET['requested']]; } else { print json_encode($_SESSION); }
html:
<input type="hidden" id="secpic" name="secpic" value=""/>http://stackoverflow.com/questions/2765175/how-to-get-session-variables-from-php-server-with-ajax-function-php-html-js-aj