本文整理汇总了PHP中code函数的典型用法代码示例。如果您正苦于以下问题:PHP code函数的具体用法?PHP code怎么用?PHP code使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了code函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addparent
function addparent($d)
{
$ardata = explode(";", $d);
$nom = $ardata[8];
$prenom = utf8_encode($ardata[9]);
$prenom2 = utf8_encode($ardata[10]);
$dn = reversedate($ardata[11]);
$obs = $ardata[12];
$obs2 = $ardata[13];
$email = $ardata[14];
$tel = $ardata[15];
$fax = $ardata[16];
$codeprenom = str_replace('-', '', $prenom);
$codenom = str_replace('-', '', $nom);
$clientcode = code($dn, $codenom, $codeprenom);
print $prenom;
$mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
$mysqli->set_charset("utf8");
$query = "INSERT INTO `" . DB . "`.`clients` (`clientcode`, `clientstatus`," . " `clientcivilite`, `clientnom`, `clientprenom`, `clientprenom2`, `clientdatenaissance`," . " `clientemail`, `clienttelephone`,`clientfax`,`obs`)" . " VALUES ('" . $clientcode . "', '1', 'MR', '" . $nom . "', '" . $prenom . "', '" . $prenom2 . "', '" . $dn . "'," . "'" . $email . "','" . $tel . "','" . $fax . "','" . $obs . " " . $obs2 . "')";
$mysqli->query($query);
$lastid = $mysqli->insert_id;
//use it to insert the details.
$mysqli->close();
print $query;
return $lastid;
}
示例2: add
function add($d)
{
$ardata = explode(";", $d);
$arbp = explode(" ", $ardata[6]);
$arprenom = explode(" ", $ardata[1]);
$nom = $ardata[0];
if (strpos($nom, "pse") > 0) {
$arnom = explode(" ", $ardata[0]);
$nom = $arnom[0];
$nommarriage = $arnom[2];
}
$prenom = utf8_encode($arprenom[0]);
$prenom2 = utf8_encode($arprenom[1]);
$gender = $ardata[2];
$dn = reversedate($ardata[3]);
$lieun = $ardata[4];
$obs = $ardata[5];
$bp = $arbp[1];
$cp = $ardata[7];
$codeprenom = str_replace('-', '', $prenom);
$codenom = str_replace('-', '', $nom);
$clientcode = code($dn, $codenom, $codeprenom);
if (!exist($clientcode)) {
$mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
$mysqli->set_charset("utf8");
$query = "INSERT INTO `" . DB . "`.`clients` (`clientcode`, `clientstatus`," . " `clientcivilite`, `clientnom`, `clientnommarital`, `clientprenom`, `clientprenom2`, `clientdatenaissance`, `clientlieunaissance`," . " `clientbp`, `clientcp`,`obs`)" . " VALUES ('" . $clientcode . "', '1', '{$gender}', '" . $nom . "', '" . $nommarriage . "', '" . $prenom . "', '" . $prenom2 . "', '" . $dn . "', '" . $lieun . "'," . "'" . $bp . "','" . $cp . "','" . $obs . "')";
$mysqli->query($query);
$mysqli->close();
print $query;
}
}
示例3: textile
function textile($text, $lite = '')
{
if (get_magic_quotes_gpc() == 1) {
$text = stripslashes($text);
}
$text = incomingEntities($text);
$text = encodeEntities($text);
$text = fixEntities($text);
$text = cleanWhiteSpace($text);
$text = getRefs($text);
$text = noTextile($text);
$text = image($text);
$text = links($text);
$text = span($text);
$text = superscript($text);
$text = footnoteRef($text);
$text = code($text);
$text = glyphs($text);
$text = retrieve($text);
if ($lite == '') {
$text = lists($text);
$text = table($text);
$text = block($text);
}
/* clean up <notextile> */
$text = preg_replace('/<\\/?notextile>/', "", $text);
/* turn the temp char back to an ampersand entity */
$text = str_replace("x%x%", "&", $text);
$text = str_replace("<br />", "<br />\n", $text);
return trim($text);
}
示例4: grab
function grab($link)
{
$link = code($link);
$link = explode('<source src="', $link);
$link = explode('"', $link[1]);
$link = $link[0];
return $link;
}
示例5: spoiler_code
/**
* @param string $content
* @param string $lang
* @param string $size
* @param string $classes
* @return string
*/
function spoiler_code($content, $lang, $size = '', $classes = '')
{
$classes = $classes ? " {$classes}" : '';
if ($size) {
$classes = "spoiler-{$size}{$classes}";
}
return spoiler(code($content, $lang), $classes);
}
示例6: test_users_model
function test_users_model($user_id, $activated)
{
$this->load->model('users');
$this->title('users');
$this->test('get_user_by_id');
$test = $this->users->get_user_by_id($user_id, $activated);
code($test);
}
示例7: test
/**
* Prints a test result
*/
function test($file, $minExpected, $skip)
{
global $cssmin;
if (!empty($skip) && in_array(basename($file), $skip)) {
p("INFO: CSSmin: skipping " . basename($file), 'info');
return;
}
$src = file_get_contents($file);
$minOutput = $cssmin->run($src);
$passed = assertTrue(strcmp($minOutput, $minExpected) === 0, 'CSSmin: ' . basename(dirname($file)) . '/' . basename($file));
if (!$passed) {
p("---Output: " . countBytes($minOutput) . " bytes", '');
$opcodes = FineDiff::getDiffOpcodes($minExpected, $minOutput);
code(FineDiff::renderDiffToHTMLFromOpcodes($minExpected, $opcodes));
p("---Expected: " . countBytes($minExpected) . " bytes", '');
code($minExpected);
p("---Source: " . countBytes($src) . " bytes", '');
code($src);
}
}
示例8: up
function up()
{
// on récupère tous les profils
$q = $this->db->get('user_data');
$old_data = $q->result();
code($old_data);
$new_data = array();
foreach ($old_data as $key => $user) {
if ($user->profile == 'candidat') {
$profile = 'perso';
} else {
$profile = $user->profile;
}
// on prépare le batch
$new_data[] = array('user_id' => $user->user_id, 'option' => 'profile', 'value' => $profile);
}
code($new_data);
// on importe tous les profils dans les options
$this->db->insert_batch('user_options', $new_data);
// on drop la colonne profil de la table user_data
$this->dbforge->drop_column('user_data', 'profile');
}
示例9: session_start
<!DOCTYPE HTML>
<?php
session_start();
require "fonctions.inc.php";
require "bd.inc.php";
$i = infosEntreprise();
$connexion = connect();
$nomE = $_GET['nomEntreprise'];
if (isset($_POST['mdp'])) {
//$mdp = md5($_POST['mdp']);
$mdp = $_POST['mdp'];
}
if (isset($_POST['nomClient']) && isset($_POST['mailClient']) && isset($_POST['prenomClient']) && isset($_POST['loginClient']) && isset($_POST['mdpClient'])) {
//récupération des infos de connexion des clients
$code = code($nomE . "_client", 'id_client');
$id = $code;
$nomClient = $_POST['nomClient'];
$prenomClient = $_POST['prenomClient'];
$mail = $_POST['mailClient'];
$login = $_POST['loginClient'];
//$mdpHash = md5($_POST['mdp']);
$mdp = $_POST['mdpClient'];
//faire fonction ajouter client
ajoutClient($connexion, $id, $nomClient, $prenomClient, $mail, $login, $mdp, $nomE);
$_SESSION["estConnecte"] = 1;
$_SESSION["nomSession"] = $_GET['nomEntreprise'];
?>
<SCRIPT language="javascript">
javascript:parent.opener.location.reload();
window.close();
</SCRIPT>
示例10: getSlideId
<section class="slide" id="<?php
echo getSlideId(__FILE__);
?>
">
<div>
<?php
echo code('php', '
// PHP
php > $foo = "10";
php > print $foo - 5;
5');
?>
</div>
</section>
示例11: getSlideId
<section class="slide" id="<?php
echo getSlideId(__FILE__);
?>
">
<div>
<?php
echo code('php', '
<?php
declare(strict_types=1); // must be the first line
(function(string $a) {
var_dump($a);
})(15);
// Fatal error: Uncaught TypeError:
// Argument 1 passed to {closure}()
// must be of the type string, integer given ...
');
?>
</div>
</section>
示例12: getSlideId
<section class="slide" id="<?php
echo getSlideId(__FILE__);
?>
">
<div>
<?php
echo code('php', '
class Person {
public $name = \'Bob\';
}
(function() {
echo $this->name;
})->call(new Person);
// Bob
');
?>
</div>
</section>
示例13: getSlideId
<section class="slide" id="<?php
echo getSlideId(__FILE__);
?>
">
<div>
<br/>
<br/>
<?php
echo code('php', '
php > echo strlen("Hello");
5
php > echo strlen("Привет");
12');
?>
</div>
</section>
示例14: code
<pre class="code fs-65">
<?php
echo code('php', '
$users = [
[\'first_name\' => \'Max\', \'last_name\' => \'Gopey\', \'company\' => \'CGI\'],
[\'first_name\' => \'Bob\', \'last_name\' => \'Doe\', \'company\' => \'Google\'],
[\'first_name\' => \'Alice\', \'last_name\' => \'Doe\', \'company\' => \'Google\'],
];
$CgiUsers = array_filter($users, function($user) {
return $user[\'company\'] === \'CGI\';
});
print_r($CgiUsers);
', false);
?>
</pre>
<pre class="code fs-65">
<?php
echo code('php', '
Array (
[0] => Array (
[first_name] => Max
[last_name] => Gopey
[company] => CGI
)
)
', false);
?>
</pre>
</div>
</section>
示例15: getSlideId
<section class="slide" id="<?php
echo getSlideId(__FILE__);
?>
">
<div>
<?php
echo code('php', '
class ContainerCollection implements Iterator {
public function current() : Container { /* ... */ };
// ...
}
$containersOnTable = new ContainerCollection();
// Your mom fills the collection here:
$eventManager->dispatch(\'serve_table\', $containers);
array_walk($containersOnTable,
function(Container $container) use ($cat) {
$cat->dropContainer($container);
}
);
', true, 'fs-80');
?>
</div>
</section>